1
我有
startMonitoringSignificantLocationChanges
问题
接收当使用下面的代码,我的iOS 8的物理设备和模拟器位置,从不打didUpdateLocations
方法:startMonitoringSignificantLocationChanges从未在<code>iOS 8</code></p> <p>iOS8上
-(void)viewDidLoad {
if (self.locationManager==nil) { self.locationManager = [[CLLocationManager alloc] init]; }
self.locationManager.activityType = CLActivityTypeFitness;
self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
self.locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
NSLog(@“requestAlwaysAuthorization”);
[self.locationManager requestAlwaysAuthorization];
}
[self.locationManager startMonitoringSignificantLocationChanges];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
NSLog(“didUpdateLocation”);
}
如果我将startMonitoringSignificantLocationChanges
替换为startUpdatingLocation
,物理设备接收到一个更新(这不是我期望的),但模拟器继续接收不断更新(这是我期望的,但不是我想要的)。
有关如何解决此问题的任何想法将不胜感激。我也宁愿用requestWhenInUseAuthorization
代替requestAlwaysAuthorization
,但我看别的地方,如果我想使用startMonitoringSignificantLocationChanges
,我需要使用requestAlwaysAuthorization
。
我'NSLocationWhenInUseUsageDescription',但并没有意识到有一个单独的'NSLocationAlwaysUsageDescription'关键。谢谢。 – Chris 2014-10-17 17:38:25