ios - 仅请求始终授权,而不请求使用时授权

标签 ios swift location uikit core-location

在 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/

相关文章:

ios - 您如何联系 Apple Game Center 排行榜上的获胜者?

iphone - 基于 TabBar 的应用程序中的注销问题

swift - Collection View 向下移动单元格

ios - 获取有关请求位置权限的错误

hadoop - 如何更改 hadoop conf 目录位置?

java - 如何设置 JOptionPane 的位置?

ios - 在 UITableViewCell 中添加 UITableView

ios - 在所有 View Controller 之间共享从服务​​器获取的数据的正确方法?

arrays - swift 5 : How do I update values in an Array of arrays?

ios - Swift中配置ios8 VPN配置和控制