升级到 Big Sur (macOS 11.0.1) 后,我们的应用程序现在要求用户授予使用蓝牙的权限。但是,据我所知,我们没有运行任何蓝牙代码。我们确实链接了CoreBluetooth,但是一直这样,一直没有出现这个提示。
在 Xcode 12.2 中运行时,它确实会崩溃并显示以下消息:
2020-11-13 13:21:58.685610-0800 Fuze[31049:200367] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.
但据我所知,NSBluetoothAlwaysUsageDescription
仅适用于 iOS 设备。
我怀疑这是 Big Sur 的新功能,因为安全和隐私的系统偏好设置 UI -> 隐私,在 Catalina 中没有蓝牙部分,而在 Bug Sur 中却有。但是 Apple 文档没有提到此密钥适用于 macOS。 https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription
所以我的问题是:
- 这个密钥现在是否适用于 macOS 并且我们应该拥有它,即使文档说它仅适用于其他平台,或者 macOS 的蓝牙是否有不同的密钥?我还没有找到一个。
- 有没有办法控制这个提示,因为我们实际上并没有使用蓝牙代码。我们需要特定功能的框架,但它不适用于许多用户,因此在应用程序启动时立即请求许可会令人困惑。
谢谢!