NSBluetoothAlwaysUsageDescription required, but bluetooth is not used

前端 未结 10 1876
青春惊慌失措
青春惊慌失措 2021-01-01 18:28

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 NSBluetoothAlwaysUsageDe

10条回答
  •  旧时难觅i
    2021-01-01 19:13

    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   ...
    
    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

提交回复
热议问题