我刚刚更新到Xcode 6 / iOS 8 SDK,并且我在模拟器中的位置服务模拟开始无法正常工作。在我进行更新之前还不错(我目前无法在真实设备上进行测试)。现在,当我选择一个模拟位置时,什么也没有发生。-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
不调用委托的方法。我重新启动了Xcode,清理了build文件夹,没有任何更改。为什么会发生这种情况?
从IOS 8开始,您需要在启动CLLocationManager之前请求授权。
您在调用这些方法之一吗?
[self.locationManager requestWhenInUseAuthorization]; // For foreground access
[self.locationManager requestAlwaysAuthorization]; // For background access
如果您是在XCode 6之前创建项目的,则可能还需要添加info.plist条目以获得新权限。
有关更多详细信息,请参见这篇文章:定位服务在iOS 8中不起作用
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句