Iphone 开始监视重要位置更改在iOS5中不起作用
这是我初始化我的位置管理器的方式:Iphone 开始监视重要位置更改在iOS5中不起作用,iphone,ios,objective-c,Iphone,Ios,Objective C,这是我初始化我的位置管理器的方式: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; [self.locationManager startMonitoringSignificantLocationChanges]; 在iOS6中,在创建委托后,立即使用我的当前位置调用委托: - (void)locati
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self;
[self.locationManager startMonitoringSignificantLocationChanges];
在iOS6中,在创建委托后,立即使用我的当前位置调用委托:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
但是,如果设备Im测试为iOS5,则永远不会调用此委托
原因可能是什么?问题在于方法
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
是iOS6的新功能,在iOS5中,您必须使用:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
正如文档中所述,一旦StartMonitoringSignificantLocation发生更改,以及在iOS6中工作,就应该调用该委托