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


签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
原文地址:https://www.cnblogs.com/season2009/p/2548149.html