位置服务在iOS 8中不起作用 [英] Location Services not working in 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 在开始位置更新之前,需要code>(仅限前景时的位置)
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屋!