Xcode 6 / iOS 8位置模拟不起作用 [英] Xcode 6/iOS 8 Location Simulation doesn't work

查看:184
本文介绍了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位置模拟不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆