Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOs] NSBluetoothAlwaysUsageDescription warning after specifying optional modules #375

Closed
rodrigojrmartinez opened this issue Oct 7, 2019 · 14 comments

Comments

@rodrigojrmartinez
Copy link

rodrigojrmartinez commented Oct 7, 2019

Hi, I'm building an Ionic 4 app meant for both Android and iOs and recently I've been starting to receive a warning from Apple App Store Connect regarding a missing purpose on why I'm using bluetooth information on my App. For my case I'm not using it at all and I've read the 'Specifying modules' section of the readme, so I know this comes by default when installing the plugin.
I've tried to do what it's suggested in this section so as to avoid having this warning

By default, all the modules will be added to your project when you install the plugin.
You can specify which modules are installed by adding a to your config.xml which specifies the modules you wish to add as a space-separated list. Module names should be capitalised.
...
If you change the modules specified in the preference, you'll need to uninstall then re-install the plugin to your project to apply the changes.

So what I've done now is to add this line over my config.xml

<preference name="cordova.plugins.diagnostic.modules" value="LOCATION WIFI" />
....
<plugin name="cordova.plugins.diagnostic" spec="^5.0.1">
  <variable name="ANDROID_SUPPORT_VERSION" value="28.+" />
</plugin>

Since this is the only information I've been retrieving for the app. Also I have a merge for Info.plist to specify why I need the location as follows:

<platform name="ios">
   ...
  <edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
     <string>Need access to detect user's position so as to have location of registrations made</string>
  </edit-config>
</platform>

I have removed the plugin and uninstall the ionic dependency as well and then reinstall it with the following commands

ionic cordova plugin remove cordova.plugins.diagnostic
npm uninstall @ionic-native/diagnostic
ionic cordova plugin add cordova.plugins.diagnostic
npm install @ionic-native/diagnostic

Which updated my package.json with the latest versions, Then I've build the app for ios just fine, then I check for the ios.json generated file and I can't find the 'NSBluetoothAlwaysUsageDescription' description on the "*-Info.plist" information (though I can see that there are other values such as NSCamaraUsageDescription, NSMicrophoneUsageDescription, etc. which I'm also not using). Then there's an entry for config.xml parents where I can indeed see

...
{
"xml": "<feature name=\"Diagnostic_Bluetooth\"><param name=\"ios-package\" value=\"Diagnostic_Bluetooth\" /><param name=\"onload\" value=\"true\" /></feature>",
"count": 1
}
...

At the end when submitting the app to the App Store for testing purposes I still receive the usual warning:

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

Am I doing something wrong? I wouldn't want to add a description of the use of data I'm not taking into account for my app since it would be a lie and I run the risk for my app to be rejected when publishing it for real. Some advice for avoiding this?

Thanks a lot!

@attebury
Copy link

attebury commented Oct 7, 2019

Are you using Phone Gap to build your apps? If so, Phone Gap essentially ignores the preference and downloads the entire plugin. I had to build the iOS version in Xcode. Others have used a forked version of the plugin. (I'd add a link but I can't find it at the moment.)

@rodrigojrmartinez
Copy link
Author

I'm using ionic actually and cordova beneath it, with the following command

ionic cordova build ios

@mathewkuttymathew
Copy link

I am having the same issue, any solution?

@alexisAvenel
Copy link

Same error for me.
Using ionic 4 / XCode 11.1 / iPhone iOS 13.1
this error appear when upgrading iOS version of iPhone into 13.+

@attebury
Copy link

attebury commented Oct 8, 2019

If you aren't using PhoneGap it may be that the bluetooth plugin is still present. I had to remove the plugin, remove the platform, make sure the preference is set in config.xml, then add the plugin, then add the platform.

@alexisAvenel
Copy link

Thank you @attebury it's good for me !

@rodrigojrmartinez
Copy link
Author

Okey, I finally got it. It wasn't enough to just uninstall and re-install the plugins & module but also the platform as well, so for anyone having this issue and to make it as clear as possible, you should

  1. remove ios platform
    ionic cordova platform remove ios
  2. uninstall ionic diagnostic node module (if using ionic)
    npm uninstall @ionic-native/diagnostic
  3. uninstall cordova diagnostic plugin
    ionic cordova plugin remove cordova.plugins.diagnostic
  4. ensure you have the desired configuration on config.xml (under general section, not platform specific)
    <preference name="cordova.plugins.diagnostic.modules" value="LOCATION" />
  5. re-install cordova diagnostic plugin
    ionic cordova plugin add cordova.plugins.diagnostic
  6. re-install ionic diagnostic node module
    npm install @ionic-native/diagnostic
  7. If you inspect the node_modules folder cordova.plugins.diagnostic/src/ios/ you will see that Diagnostic_Bluetooth is still present, this got me confused but is not a problem
  8. re-add the ios platform
    ionic cordova platform add ios
  9. If you go to platforms/ios/YOUR_APP/Plugins/cordova.plugins.diagnostic you should see there's no BlueTooth file present Which means the configuration got applied
  10. build your project and then open XCode to build native ios app and submit to distribution as usual
    ionic cordova build ios

@cassini-usman
Copy link

@rodrigojrmartinez Thanks. It worked!

1 similar comment
@2diegoduque
Copy link

@rodrigojrmartinez Thanks. It worked!

@molinet88
Copy link

The preference cordova.plugins.diagnostic.modules is not working with ionic@2 & cordova@6.
I followed @rodrigojrmartinez steps but all modules are present in platforms/ios/YOUR_APP/Plugins/cordova.plugins.diagnostic folder.
The plugin version i'm using is 4.0.8 due to cordova@6.5.0 compatibility.
@dpa99c Any clues on this? Thanks!

@dpa99c
Copy link
Owner

dpa99c commented Mar 11, 2020

@molinet88 I suggest updating to latest cordova (CLI) and cordova-android (platform) versions then you can update to the latest version of this plugin.

@molinet88
Copy link

@dpa99c Yes, but I wanted to skip this solution because it's too aggressive to all project dependencies.
Just to clarify, since plugin version 4 the modules preference should work, isn't it?

@dpa99c
Copy link
Owner

dpa99c commented Mar 11, 2020

In theory it should work but I can't support such old versions of the plugin so if you're having issues, you'll need to resolve them yourself.

@molinet88
Copy link

Sure, it's a mess to use old versions...
I finally solved it updating cordova CLI to latest version (9.0.0) and using plugin version 4.0.8 (due to cordova-android@6.1.2 compatibility).
That way the modules preference is working fine!
Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants