目前,我有一个使用用户当前地理位置的应用程序。
每当我在设备或模拟器上运行该应用程序时,该应用程序就会打开,并立即将我的位置服务从“授权”变为“未确定”。由于某种原因,这只发生在我身上,而我的其他开发人员都没有。
我不确定这是否是Xcode的问题,我昨晚将其更新为6.01,或者我的代码中有问题。
我曾尝试为该应用程序重置位置服务,但是当我返回该应用程序时,它立即将其更改回“未确定”。
知道是什么原因导致了这个问题吗?有没有人遇到过类似的问题?
以下是我的locationManager的一小段代码。
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status{
NSLog(@"did change status");
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
NSLog(@"not determined");
} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
NSLog(@"Authorized");
[[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Authorized" object:self];
} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted){
NSLog(@"restricted");
[[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Restricted" object:self];
} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
NSLog(@"denied");
[[NSNotificationCenter defaultCenter] postNotificationName:@"Location Services Denied" object:self];
} else {
NSLog(@"can not");
我解决了问题!
事实证明,苹果对其核心位置管理器进行了几处更改。
你可以在这里读更多关于它的内容:
http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/
谢谢您的帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句