停止空想

老张的空中之家

存档于 ‘iPhone’ 分类

让iphone不使用定位的cache(转)

作者:admin 发表时间:三月 - 28 - 2009

A short note on CLLocation / CLLocationManager

**** DEPRECATED **** Use http://liip.to/ilocator

Well.. I’ve been testing this Locator quite a while now. Today I had my final attempt, to find out, why I always got either a cached location or an extremely inaccurate location.

Today, I went out with my notebook (yes, there where the sun is..) to debug.

The example of apple says, to check the timestamp of the newLocation. (It should be less than 5..). Yeah well, guess what - it is sometimes 0 in a cached location. And somehow it’s sometimes just a bit over 5 and you’ll have to wait forever to get a new location.

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    NSDate* eventDate = newLocation.timestamp;
    NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];

    if (howRecent < -0.0 && howRecent > -10.0) {
        [manager stopUpdatingLocation];

        // USE THE FORCE OF THE LOCATION!
    }
}

This one should work. Maybe that location stuff is working in the U.S. but it wasn’t in Switzerland..

P.S.: I had another issue with a pwned iPhone today. NSXMLParser throw me errors back and I didn’t know why.. I still don’t know why, I guess it had to do with the libxml2 update I did. Workaround? Restore, works fine now.

类别:Cocoa, iPhone, 苹果

分享一个写了很久的电视查询软件─tv2iCal

作者:admin 发表时间:三月 - 15 - 2009

 

我写的这个软件名字叫做tv2ical,是苹果电脑的专用软件,不是for windows平台的,今后也没有打算写windows版本的相应软件。现在已经是1.2.1版本了。 

主要功能就是电视节目查询,并且可以将查询到自己喜爱的节目通过鼠标的点击添加到ical(相当于windows 的outlook里面的日历功能)程序中。

阅读全文 »

类别:Cocoa, iPhone, 苹果