Ask for only Request Always Authorization, and not

2019-07-26 14:57发布

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条回答
可以哭但决不认输i
2楼-- · 2019-07-26 15:47

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.

查看更多
登录 后发表回答