应用程序的 Info.plist 文件应包含一个 NSBluetoothAlwaysUsageDescription 键,而该键位于 plist 文件中

The app's Info.plist file should contain a NSBluetoothAlwaysUsageDescription key while the key is in the plist file

首先,我想声明我已经看过 并且添加 iCoder 和 Deepak 提到的任何一个都没有解决我的问题。

我正在使用 React-Native 开发我的应用程序,包括我找到的这个 React-Native-Permissions 包。他们的文档指出我应该添加他们的包启用的所有权限,例如位置、相机和所有其他在那里提到的。完成此操作后,我就可以将我的应用程序上传到商店并提交以供审核。

今天我到了办公室,看到有一些来自 Apple 的反馈。因此,在我完成反馈后,我想再次 re-upload 到商店(增加内部版本号,因为我应该这样做)。

现在我不断收到上面提到的标题中的消息,而我的 info.plist 中有它,就像这样

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes the react-native-permissions library, which references this permission in its code.</string>

编辑:

我希望澄清以下内容,以便找到我面临的问题的答案。标题中给出的错误是在上传到商店后直接发生的(所以我猜实际错误是由系统自动检查出来的)。

下面的答案不会帮助我解决问题,因为自动系统检查不会检查更具描述性的字符串。我已经成功地将此字符串用于 info.plist 中的其他元素。除此之外,我发现有证据表明人们使用这种策略成功地将他们的应用程序提交到应用程序商店。如 Gradner 的评论所示 link React Native Permission issue 266

我不明白为什么第一次它不工作,但今天当我进入办公室时,我看到 Sumeet.Jain 发表的评论建议我应该更换

NSBluetoothPeripheralUsageDescription key with the NSBluetoothAlwaysUsageDescription key

这实际上会导致一个错误,如我们预期的那样,会提示缺少 NSBluetoothPeripheralUsageDescription。因此,我将 NSBluetoothPeripheralUsageDescription 重新添加到我的 info.plist 中,现在我终于可以将我的应用程序上传到商店了。感谢所有帮助过我的人。

p.s。与昨天相比,我唯一能想到的就是我现在使用 Xcode 添加了密钥,而不是仅仅在我用于 react-native 的编辑器中编辑 info.plist 文件。希望这对其他人有所帮助,因为它对我有帮助

我找到了根本原因

我们在 plist 中有以下两个默认选项来输入蓝牙使用。

1.Privacy - 蓝牙外设使用说明 2.Privacy - 蓝牙始终使用说明

但是Xcode将此选项保存在源代码中,如下所示

1.NSBluetoothPeripheralUsageDescription代替隐私-蓝牙外设使用说明

2.Privacy - 蓝牙始终使用说明而不是隐私 - 蓝牙始终使用说明

所以现在重点是 NSBluetoothPeripheralUsageDescription 已弃用,它需要密钥 "NSBluetoothAlwaysUsageDescription"

Here is the solution, open the plist file as source code in Xcode and copy-paste the below key-value pair

Key: NSBluetoothAlwaysUsageDescription Value: This application requires bluetooth in order to bla bla bla.

如果您没有使用蓝牙,

只需将此添加到您的 Info.plist 文件中:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes the react-native-permissions library, which references this permission in its code.</string>

Apple 弃用了 NSBluetoothPeripheralUsageDescription 属性,取而代之的是 NSBluetoothAlwaysUsageDescription。

在此处查看详细信息: link to Apple docs

如果您使用的是蓝牙,

只需将此添加到您的 Info.plist 文件中:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app uses bluetooth to find, connect and transfer data between different devices</string>

有人发布了对我有帮助的答案,但随后将其删除!解释一下答案:

在不知道是什么触发了 Apple 错误的情况下将隐私密钥添加到 plist 并不是解决此问题的最佳方法。

就我而言,当我进行 grep 搜索时,我发现在我的 project.pbxproj 中有一些对 CoreBluetooth.framework 的引用。我删除了引用,构建和 TestFlight 上传成功!

要搜索,请使用以下命令:

grep -r -a CoreBluetooth.framework ProjectFolder

嗯,我解决了这个问题。

如果您的应用正在使用蓝牙,那么您必须将其添加到 info.plist。

NSBluetoothAlwaysUsageDescription

我们的应用程序使用蓝牙来...做一些事情...

如果您的应用不需要蓝牙但意外提示。

然后:

打开 Xcode : 去删除 CoreBluetooth.framework:

  1. -> 你的项目 -> 框架 -> CoreBluetooth.framework
  2. -> yourproject -> Build Phases -> 键入搜索以查找“Bluetooth”(删除所有相关的“Bluetooth”)

对我有用! 希望能帮到你。

我能够在应用程序打开时成功移除蓝牙权限警告。在我的例子中,问题出在库“react-native-connectivity-status”上。我将库从版本“1.5.2”降级为“1.5.1”。

步骤如下:

改变

"react-native-connectivity-status": "^1.5.1",

"react-native-connectivity-status": "1.5.1",

然后 运行 以下命令:

rm -rf node_modules/
rm package-lock.json
npm i
cd ios/
rm -rf Pods/
pod install

对于早于 iOS13 的部署目标,将 NSBluetoothAlwaysUsageDescription 和 NSBluetoothPeripheralUsageDescription 添加到您应用的信息 属性 列表文件

字符串取决于您是否使用蓝牙。

<key>NSBluetoothAlwaysUsageDescription</key>
    <string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes some library, which references this permission in its code.</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes some library, which references this permission in its code.</string>