问题描述
我刚用iOS 11 SDK重建了我的应用程序,试图删除现在总是出现的蓝色横幅
。我认为 - 很棒,有效,只是发现位置服务现在根本不起作用。
I just rebuilt my app with the iOS 11 SDK in an attempt to remove the blue banner
that is now always appearing. I thought - "Brilliant, that worked", only to discover that location services are now not working at all.
用于iOS 10的应用程序 - 有没有人听过什么?
The application used to work with iOS 10 - Has anybody heard anything?
推荐答案
看来苹果已经添加了另一项隐私功能。用户现在可以覆盖我们的 requestAlwaysAuthorization
并将其降级为 requestWhenInUseAuthorization
- 这意味着作为开发人员我们现在必须提供 Info.plist中的两种描述
It would appear that apple have added yet another privacy feature. The user is now able to override our requestAlwaysAuthorization
and downgrade it to requestWhenInUseAuthorization
- Which means as a developer we now have to supply both descriptions in the Info.plist
我发现他们添加了一个新密钥 NSLocationAlwaysAndWhenInUseUsageDescription
I found that they have added a new key NSLocationAlwaysAndWhenInUseUsageDescription
/*
* Either the NSLocationAlwaysAndWhenInUseUsageDescription key or both the
* NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription
* keys must be specified in your Info.plist; otherwise, this method will do
* nothing, as your app will be assumed not to support Always authorization.
*/
然而,在使用这个新密钥时 - 位置服务仍然没有工作,进一步搜索我发现这个宝石混入了所有额外的调试信息:
However, upon using this new key - the location service still didn't work, upon further searching I found this gem mixed in with all the extra debugging information:
直接与我在更新的 CLLocationManager.h
文件中找到的注释相矛盾。所以我创造了一个雷达。
Which directly contradicts the the comment that I found in the updated CLLocationManager.h
file. So I've created a radar.
好消息,如果你按照调试控制台的建议,IE。同时添加新键 NSLocationAlwaysAndWhenInUseUsageDescription
和旧密钥的一个 NSLocationWhenInUseUsageDescription
,位置服务将开始重新工作。
Good news, if you follow the advice of the debugging console, IE. add both the new key NSLocationAlwaysAndWhenInUseUsageDescription
and one of the old keys NSLocationWhenInUseUsageDescription
, locations services will start to work again.
这篇关于位置服务在iOS 11中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!