NSBluetoothAlwaysUsageDescription required, but bl

2020-02-27 18:55发布

In my ios app with new Xcode 11 GM Seed 2 after deploy, apple returned error: ITMS-90683: Missing Purpose String in Info.plist with NSBluetoothAlwaysUsageDescription.

https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription?language=objc readed.

The problem is that I don't use bluetooth in my app. Or maybe I don't know about it. How can I find out why this permission purpose is needed?

I'm not using CoreBluetooth.framework

8条回答
【Aperson】
2楼-- · 2020-02-27 19:23

I've tried Maurice's answer, with and without .framework extension, but did not find any reference to CoreBluetooth in my project. I also had previously in Info.plist file added: "Privacy - Bluetooth Peripheral Usage Description", with String Value: "App would like to use your bluetooth for communication purposes"". This didn't work either.
Finally after seeing Chase Roberts's answer I added: "NSBluetoothAlwaysUsageDescription", with String value: "App would like to use your bluetooth for communication purposes". After that this error was not shown again for my app while publishing.

Note: In warning for error: ITMS-90683, for my app was said that delivery was successful, but I can if I wish to make changes in regard to stated issue.

查看更多
老娘就宠你
3楼-- · 2020-02-27 19:25

You should add both NSBluetoothPeripheralUsageDescription and NSBluetoothAlwaysUsageDescription to your Info.plist file. Your Info.plist file is located (by default) inside your prroject folder "Supporting Files" group and may be called something like {PROJECTNAME}-Info.plist. You have a couple of choices for adding it. One choice is to just editthe file from the command line using vim or whatever. Then add these lines:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>App would like to use your bluetooth for communication purposes</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App would like to use your bluetooth for communication purposes</string>

The second choice is to double click that Info.plist file in XCode and use the "super helpful" XCode editor. This annoying editor does not actually have the NSBluetoothAlwaysUsageDescription in a dropdown list, you have to add it manually. Super helpful. Anyway there is a little plus button to the right of the Information Property List header, just click that. In step 1 you look for "Privacy - Bluetooth Peripheral Usage Description". That is the readable name for NSBluetoothPeripheralUsageDescription. Then just click on the value part at the right and enter your text, like "App would like to use your bluetooth for communication purposes" or watever. Once that is done, click that same plus button again and you will get the same drpdown list. Ignore that list and just paste the string NSBluetoothAlwaysUsageDescription there. Then click on the value to the right and paste "App would like to use your bluetooth for communication purposes".

查看更多
一夜七次
4楼-- · 2020-02-27 19:27

If your app has a deployment target earlier than iOS 13, add the NSBluetoothPeripheralUsageDescription key to your app’s Information Property List file in addition to NSBluetoothAlwaysUsageDescription key as one or more of third party in your project uses bluetooth functionality.

查看更多
Root(大扎)
5楼-- · 2020-02-27 19:28

I was able to snuff out CoreBluetooth usages by scanning for symbol usages, specifically looking for CBCentralManager. The script I wrote to do so:

#!/usr/bin/env bash
#
# find-bluetooth-usages.sh <app1.app> <app2.app> ...

check_references_corebluetooth() {
  nm "$1" | grep "CBCentralManager" 2>&1 >/dev/null
}

find_usages () {
  app_path=$1
  if [[ ! -d $app_path || ! -d "$app_path/Frameworks" ]]; then
    echo "$app_path is not a valid app directory."
    exit 1
  fi
  app_filename=$(basename -- "$app_path")
  app_name="${app_filename%.*}"

  if check_references_corebluetooth "$app_path/$app_name"; then
    echo "$app_name contains references to CoreBluetooth"
  fi
  for framework_filename in $(ls "$app_path/Frameworks" | egrep '\.framework$'); do
    framework_path="$app_path/Frameworks/$framework_filename"
    framework_name=$(basename "$framework_path" .framework)
    if check_references_corebluetooth "$framework_path/$framework_name"; then
      echo "$framework_name contains references to CoreBluetooth"
    fi
  done
}

for arg in "$@"; do
  find_usages "$arg"
done

This will dig through the main binary + its included frameworks to find CBCentralManager references. Ex:

./find-bluetooth-usages.sh /path/to/MyApp.app

查看更多
叼着烟拽天下
6楼-- · 2020-02-27 19:33

Open your Info.plist and add a NSBluetoothAlwaysUsageDescription. You can do this in the editor by adding a line item like this:

Screenshot of info.plist with NSBluetoothAlwaysUsadeDescription as the key and explanation text as the String value

Or you can right click on the Info.plist and Open As -> Source Code and paste in the two appropriate lines as xml:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
    ....
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>We use Bluetooth to connect to the MantisX hardware device.</string>
    ....
</dict>
</plist>
查看更多
可以哭但决不认输i
7楼-- · 2020-02-27 19:38

Apparently Apple has made some policy changes. Otherwise, it is weired to ask for non-used flags. It is very concerning. I also got my apps rejected for these reasons, all the while older versions are running without this.

查看更多
登录 后发表回答