位置服务在iOS 8中不起作用 [英] Location Services not working in iOS 8

查看:197
本文介绍了位置服务在iOS 8中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS  7上运行良好的应用无法与iOS  8 SDK一起使用。

My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK.

CLLocationManager 没有返回位置,我也没有在设置 - > 位置服务下看到我的应用。我在这个问题上进行了谷歌搜索,但没有任何结果。可能有什么问题?

CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be wrong?

推荐答案

我最终解决了自己的问题。

I ended up solving my own problem.

显然在iOS 8 SDK中, requestAlwaysAuthorization (用于后台位置)或 requestWhenInUseAuthorization (仅限前景时的位置) CLLocationManager

Apparently in iOS 8 SDK, requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground) call on CLLocationManager is needed before starting location updates.

那里还需要 NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription 键入 Info.plist 在提示中显示消息。添加这些解决了我的问题。

There also needs to be NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key in Info.plist with a message to be displayed in the prompt. Adding these solved my problem.

希望它可以帮助其他人。

Hope it helps someone else.

编辑:有关更多信息,请查看: Core-Location-Manager-changes-in-ios-8

For more extensive information, have a look at: Core-Location-Manager-Changes-in-ios-8

这篇关于位置服务在iOS 8中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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