我有一个应用程序想获取用户位置。正如你可能知道,苹果改变用户的私人政策(如我建议),现在我无法获得用户的位置。它显示没有错误,没有警告,什么都没有。在尝试调用[_locationManager startUpdatingLocation];
之前解决这个我添加以下代码在那里,它是:iOS 8中破解的位置服务
CLAuthorizationStatus authStatus = [CLLocationManager authorizationStatus];
if (authStatus == kCLAuthorizationStatusNotDetermined) {
[_locationManager requestWhenInUseAuthorization];
NSLog(@"Case 1");
return;
};
if (authStatus == kCLAuthorizationStatusDenied || authStatus == kCLAuthorizationStatusRestricted) {
// show an alert
NSLog(@"Case 2");
return;
};
和输出是情况1,这意味着 - authStatus == kCLAuthorizationStatusNotDetermined
。 但没有提醒,没有提示,没有建议用户启用我的应用程序的位置服务。实际上,我甚至在我的iPhone设置中手动打开它。仍然不工作(它在Xcode更新之前完美工作)。
如何解决这个问题? 任何意见,将不胜感激,谢谢!
您应该始终调用'requestWhenInUseAuthorization'来移除if语句。另外,您是否已将所需的密钥添加到您的info.plist中? – Paulw11 2014-09-27 21:32:05
[Xcode 6 GM - CLLocationManager]可能的重复(http://stackoverflow.com/questions/25844430/xcode-6-gm-cllocationmanager) – 2014-09-27 21:52:29
在http://datacalculation.blogspot.in/2014/11找到描述性解决方案/how-to-fix-cllocationmanager-location.html – 2014-11-02 17:19:27