Xcode 6 / iOS 8位置模拟不起作用

编程入门 行业动态 更新时间:2024-10-28 17:16:05
本文介绍了Xcode 6 / iOS 8位置模拟不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚更新到Xcode 6 / iOS 8 SDK,我在模拟器中的位置服务模拟开始无法正常工作。我更新之前没事(我目前无法在真实设备上测试)。现在,当我选择一个模拟位置时,没有任何反应。委托的 - (void)locationManager :( CLLocationManager *)管理器didUpdateLocations :( NSArray *)位置方法未被调用。我重新启动了Xcode,清理了构建文件夹,没有任何改变。为什么会发生这种情况?

I've just updated to Xcode 6/iOS 8 SDK and my location service simulation in simulator started not working. It was fine before I updated (I'm currently unable to test on real device). Now, when I select a location for simulation, nothing happens. Delegate's -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations method is not called. I've restarted Xcode, cleaned the build folder, nothing changed. Why can this happen?

推荐答案

从IOS 8起,您需要在启动CLLocationManager之前请求授权。

Since IOS 8 you need to ask for authorization before starting the CLLocationManager.

您是否正在调用其中一种方法?

Are you calling one of these methods?

[self.locationManager requestWhenInUseAuthorization]; // For foreground access [self.locationManager requestAlwaysAuthorization]; // For background access

如果您在XCode 6之前创建了项目,则可能还需要添加新权限的info.plist条目。

If you have created the project before XCode 6, you probably also need to add the info.plist entry for the new permission.

有关详细信息,请查看此帖:位置服务在iOS 8中无效

For more details have a look at this post: Location Services not working in iOS 8

更多推荐

Xcode 6 / iOS 8位置模拟不起作用

本文发布于:2023-10-08 03:29:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471390.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   位置   Xcode   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!