在ios 6上通过我的应用程序获取当前用户的位置有问题
问题描述:
我的应用程序在iOS 5上运行良好,我得到了普通用户的位置信息。但在iOS 6上安装我的应用程序时,我的应用程序无法获取用户的位置(我没有弹出询问权限的位置,在位置服务中我没有我的应用程序的图标。其他应用程序,如Instagram
和Path
在iOS 6上的位置服务中有应用程序的图标)。当我使用下面的代码来检查这个问题时,NSlog
显示:Unable to determine, possibly not available
在ios 6上通过我的应用程序获取当前用户的位置有问题
我不明白为什么会出现这种情况。我尝试过其他应用,例如Instagram或Path。我们仍然可以获得正常用户的位置。我在CLLocationManagerDelegate
中研究了iOS 6更改方法委托,但我认为这不是原因,因为我的应用程序没有要求获取用户位置的权限。
if ([CLLocationManager locationServicesEnabled]) {
NSLog(@"Location Services Enabled");
switch ([CLLocationManager authorizationStatus]) {
case kCLAuthorizationStatusAuthorized:
NSLog(@"We have access to location services");
break;
case kCLAuthorizationStatusDenied:
NSLog(@"Location services denied by user");
break;
case kCLAuthorizationStatusRestricted:
NSLog(@"Parental controls restrict location services");
break;
case kCLAuthorizationStatusNotDetermined:
NSLog(@"Unable to determine, possibly not available");
break;
default:
break;
}
}
else {
NSLog(@"Location Services Are Disabled");
}
答
我有同样的问题。对于我的应用程序产生这种情况,因为我检查是否启用locationServices,我开始更新位置仅如果这是真的([self.locationManager startUpdatingLocation]。)
+ (BOOL)locationServicesEnabled {
if (([CLLocationManager locationServicesEnabled]) && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) {
return YES;
} else {
return NO;
}
}
[self.locationManager startUpdatingLocation]没有检查一下没问题,但可能会产生其他问题。
任何人的帮助,我迫切需要解决这个问题。 非常感谢你 – user1186747
也许我的应用程序与ios6有冲突? – user1186747