停止空想

老张的空中之家

存档于 ‘Cocoa’ 分类

让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, 苹果

写了一个mac addressBook的插件程序

作者:admin 发表时间:四月 - 30 - 2008

iphone没有进入中国,所以电话簿的功能当然不考虑中国──电话簿没有搜索功能,只有靠电话簿边缘的从A-Z的26个字母来快速导航。但是受限制的是,只有联系人前面+字母才可以。比如张三变成z张三。这样做一是工作量太大,而且也不美观。

还有一个方法是给每个联系人添加拼音字段。这样iphone就会默认按照拼音的顺序来排序达到我们的目的。但是同样的问题是工作量……

阅读全文 »

类别:Cocoa