Ask for only Request Always Authorization, and not When-In-Use Authorization

混江龙づ霸主 提交于 2019-12-11 05:14:09

问题


In iOS 11 onwards we follow these instructions from Apple:

You are required to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUsageDescription keys in your app's Info.plist file. (If your app supports iOS 10 and earlier, the NSLocationAlwaysUsageDescription key is also required.) If those keys are not present, authorization requests fail immediately.

This shows both "Always" and "When in Use" options when the user is prompted to enable location tracking.

However we'd like to show just the "Always" option. Is this possible?


回答1:


On iOS 11, that is not possible. You are required to handle the case of “when in use” if you are asking for “always”. It is explained clearly in this WWDC video starting at time 10:55.



来源:https://stackoverflow.com/questions/46847547/ask-for-only-request-always-authorization-and-not-when-in-use-authorization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!