ios - scan - iphone bluetooth protocol




NSBluetoothAlwaysUsageDescription required, but bluetooth is not used (5)

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


A third party library/framework/pod in your app might be using CoreBluetooth. Just add NSBluetoothAlwaysUsageDescription in your Info.plist, error will be gone.


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.


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 "[email protected]"; 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


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.


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

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>




xcode11