在 iOS 11 及更高版本中,我们遵循 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.
当提示用户启用位置跟踪时,这会同时显示“始终”和“使用时”选项。
但是我们只想显示“始终”选项。这可能吗?
最佳答案
在 iOS 11 上,这是不可能的。如果您要求“始终”,则需要处理“使用时”的情况。 this WWDC video中解释得很清楚从 10:55 开始。
关于ios - 仅请求始终授权,而不请求使用时授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46847547/