NSBluetoothAlwaysUsageDescription 提交被拒

针对iOS应用在提交审核时遇到的ITMS-90683错误,即缺少NSBluetoothAlwaysUsageDescription键的问题,本文详细解释了该错误的出现原因及解决办法。iOS13更新后,原NSBluetoothPeripheralUsageDescription已被替换,需在Info.plist文件中添加新的蓝牙权限描述字段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

被拒

提交以后构建显示正在处理中,等几分钟会自动消失,构建不成功

Apple发送邮件提示:

ITMS-90683: Missing Purpose String in Info.plist - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSBluetoothAlwaysUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data are required to include a purpose string. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

出现原因

iOS13 将废弃 NSBluetoothPeripheralUsageDescription 替换为 NSBluetoothAlwaysUsageDescription

参考地址https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/accessing_protected_resources?language=objc

 

解决方法

 在info.plist中添加新字段

 重新上传即可

 

<think>好的,我现在需要解决用户的问题:在iOS中配置UIBackgroundModes以支持蓝牙中心模式。首先,我得回忆相关的iOS开发知识,特别是关于后台模式和蓝牙权限的设置。 用户提到的是UIBackgroundModes和bluetooth-central模式,我记得在Info.plist文件中需要添加特定的键值。根据引用[4],如果应用需要在后台执行蓝牙相关的任务,必须在Info.plist中声明支持Core Bluetooth的后台模式。这允许系统在应用暂停时唤醒它处理蓝牙事件,比如心率检测器的数据传输。 接下来,具体的配置步骤应该是怎样的呢?引用[1]和[2]提到需要配置Info.plist,可能是在Xcode中修改设置。通常,可以通过Xcode的图形界面或者直接编辑Info.plist文件来添加UIBackgroundModes数组,并在其中加入bluetooth-central项。引用[2]中的案例也强调了正确配置后台模式的重要性,否则可能导致权限问题或被App Store绝。 另外,引用[3]指出,如果应用需要展示后台蓝牙功能,比如在后台运行时播放声音,用户可能需要通过按下Home键来触发后台模式,并在提交演示视频时展示这一点。这可能涉及到测试时的注意事项,确保后台功能在实际使用中能被正确唤醒。 步骤可能包括:打开项目的Info.plist,添加UIBackgroundModes键,类型为数组,然后添加bluetooth-central作为元素。同时,需要确保其他相关配置正确,比如蓝牙权限的描述,如NSBluetoothAlwaysUsageDescription,否则应用可能会被绝上架,如引用[1]和[2]中的案例所述。 测试阶段,应用在后台处理蓝牙事件时,可能需要通过调试语句验证状态变化,如引用[5]中的Debug.WriteLine,这在iOS中可能需要使用NSLog或其他的日志方法。同时,确保系统能正确唤醒应用,处理蓝牙事件,比如重新连接到外设或接收数据。 还需要注意,即使配置了后台模式,苹果对后台运行的应用有严格的审核标准,必须确保应用确实需要持续蓝牙交互,如健康监测设备,否则可能会被绝。引用[3]提到审核时可能无法定位后台蓝牙功能,因此提供清晰的演示视频和说明文档很重要。 总结步骤:配置Info.plist添加UIBackgroundModes数组和bluetooth-central项,添加必要的权限描述,测试后台功能,准备审核材料。同时,参考官方文档和帮助文件,如引用[1]提到的Xcode帮助文档,确保配置正确无误。</think>在 iOS 应用中配置 `UIBackgroundModes` 支持蓝牙中心模式(`bluetooth-central`)需通过以下步骤实现: --- ### 步骤 1:修改 Info.plist 文件 1. **打开项目中的 `Info.plist` 文件** 通过 Xcode 导航到项目的 `Info.plist` 文件(通常位于项目根目录)。 2. **添加 `UIBackgroundModes` 键** - 在属性列表编辑器中,点击 **+** 按钮新增一行。 - 输入键名:`UIBackgroundModes`(或选择系统自动补全的 `Required background modes`)。 - 设置类型为 **Array**。 3. **添加 `bluetooth-central` 值** - 在 `UIBackgroundModes` 数组下新增一项,输入值:`bluetooth-central`。 - 最终效果如下: ```xml <key>UIBackgroundModes</key> <array> <string>bluetooth-central</string> </array> ``` --- ### 步骤 2:添加蓝牙权限描述 根据 App Store 审核要求,需在 `Info.plist` 中声明蓝牙使用目的: ```xml <key>NSBluetoothAlwaysUsageDescription</key> <string>应用需要蓝牙权限以连接外部设备并传输数据</string> ``` --- ### 步骤 3:代码适配 在 `CoreBluetooth` 框架中,需确保以下行为支持后台模式: 1. **保持 `CBCentralManager` 的持久化** 确保 `CBCentralManager` 实例在应用生命周期内不被释放。 2. **处理后台事件** 实现 `centralManager:willRestoreState:` 代理方法,以恢复蓝牙连接或任务: ```swift func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) { let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] // 恢复外设连接或操作 } ``` --- ### 注意事项 - **审核要求** Apple 要求后台蓝牙功能必须为实际使用场景(如健康设备数据同步)。若提交审核,建议提供演示视频展示后台蓝牙功能[^3][^4]。 - **性能影响** 后台模式会消耗更多电量,建议仅在必要时启用[^2]。 --- ### 示例配置文件片段 ```xml <dict> <key>UIBackgroundModes</key> <array> <string>bluetooth-central</string> </array> <key>NSBluetoothAlwaysUsageDescription</key> <string>用于连接心率监测器并同步数据</string> </dict> ```
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值