server did not accept client registration

在模拟器上获取Location出现“server did not accept client registration”错误,查询得知这是一个bug(xcode 3.2.6)

 

解决方法是在xxAppDelegate.m文件顶部(imports之后,@implementation之前)添加下面的Hack代码:

代码出处:http://forums.bignerdranch.com/viewtopic.php?f=79&t=2069

 

@implementation CLLocationManager (TemporaryHack)

- (void)hackLocationFix
{
    CLLocation *location = [[CLLocation alloc] initWithLatitude:42 longitude:-50];
    [[self delegate] locationManager:self didUpdateToLocation:location fromLocation:nil];     
}

- (void)startUpdatingLocation
{
    [self performSelector:@selector(hackLocationFix) withObject:nil afterDelay:0.1];
}

@end
posted @ 2012-06-13 16:54  Season2009  阅读(312)  评论(0编辑  收藏  举报