NSBluetoothAlwaysUsageDescription key missing (though present) - ios

While working on an iOS app written in Swift, I am having trouble with the Info.plist. Here is the issue:
The unique Info.plist file contained in the project has an NSBluetoothAlwaysUsageDescription key.
For reference, here is the relevant part of Info.plist:
<key>NSBluetoothPeripheralUsageDescription</key>
<string>The app uses bluetooth to transfer data to a neighbouring device.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>The app may frequently use bluetooth to transfer data to peers.</string>
But when I run the app on my iPhone, I see this error in the Xcode debugging console:
2021-06-06 11:20:21.235717+0900 TheApp[5010:1066154] [access] This app has crashed because
it attempted to access privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key
with a string value explaining to the user how the app uses this data.
There is already a contradiction at this point that I do not explain.
For some further investigation, I do as follows:
Product
-> Archive
-> Distribute App
-> Development: Distribute to members fo your team.
-> Export
There I change the name TheApp.ipa to TheApp.zip and uncompress it.
Then inside the Payload folder, on TheApp.app I do:
Show Package Contents
There I see an Info.plist item which I click to take a look at.
And for some unknown reason the NSBluetoothAlwaysUsageDescription key is indeed missing.
This last point may explain the error message I was getting earlier, but I still don't know why the key has disappeared.
Anyone who can shed light on this issue will be very welcome.

I finally found the solution.
While looking and trying out various things I discovered a duplicate of Info.plist.
MyApp copy-Info.plist
This ghost Info.plist contained wrong contents and looking at it, that explained all the weird observations I was making.
For some reason the building process was using the ghost file instead of using mine. And the actual Info.plist was ignored.

Related

App Store Connect App rejected missing Purpose Strings but Strings exist in InfoPlist.strings

I am developing a Flutter app and submitting it to App Store Connect and instantly get an email that the App was rejected because of
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 NSContactsUsageDescription 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).
Supposedly there are 5 purpose strings missing.
It's right that my App is using the APIs listed in the email but I have the keys in my Info.plist file and when running the app on my iPhone the purpose strings are shown when the app requests the corresponging permissions from the user. I even translated the strings using InfoPlist.strings files in the folders en.lproj etc. In the Info.plist I referenced the translated string like this
<key>NSContactsUsageDescription</key>
<string>$(NSContactsUsageDescription)</string>
I already tried unpacking the .xcarchive (in Mac Finder right click -> Show Package Contents) and the .ipa files. In those I found the Runner.app (I think Runner is a Flutter specific "name") and also showed package contents. I found the Info.plist and when I open it in a TextEditor or also XCode the Strings are gone but the InfoPlist.strings files are still there.
I think that something goes wrong when exporting so that the values are cleared?
I actually asked the question to answer it myself hoping that it might help somebody because it took me a hell lot of time to figure out the problem, even though the solution is so easy:
I don't know from which tutorial / Stackoverflow answer or wherever else I had the trick with referencing the translations as a variable as shown in the question.
<key>NSContactsUsageDescription</key>
<string>$(NSContactsUsageDescription)</string>
Just replace the variable with a real purpose string (your app's primary language maybe? I just copy pasted the values from the English string file.)
<key>NSContactsUsageDescription</key>
<string>The reason for access to contacts is…</string>
It seems that those variables are evaluated at build time and not (also) runtime. Because they don't exist, Xcode places an empty string in the Info.plist file. During runtime the InfoPlist.strings files are searched for values overwriting those in Info.plist and therefore the internationalisation did work even though it was actually implemented incorrectly. It seems that for submission to the AppStore it is not enough to have the values in .strings files but there must be a fallback purpose string in Info.plist
A reference from Apple about localising Info.plist can be found here.

Xamarin iOS project Info.plist issues during submission on App Store

I am developing project which use the following permissions in Info.plist: NSCameraUsageDescription,
NSPhotoLibraryUsageDescription, NSMicrophoneUsageDescription, NSPhotoLibraryAddUsageDescription, NSCalendarsUsageDescription. App can browse photos library or take a picture. After the deployment process for submission on App Store I get the info:
The app's Info.plist file should contain a NSLocationAlwaysUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.
The app's Info.plist file should contain a NSLocationWhenInUseUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.
In my app I don't use or ask user for location permission. Moreover I use the NuGet packages: Xamarin.Essentials, Forms, Plugin.Permissions. How can I workaround this issue with location permissions to avoid placing this ?
There is nothing that you can do to workaround the problem aside from removing plugins.
And there are no reasons to do something like that as the end-user won't see any difference unless you ask for the location in the app's code. Info.plist is not visible to the end user in any way including through the app listing.

"Missing Purpose String in Info.plist File" not actually missing

Attached is what I get from Apple after uploading to the App Store Connect, even though all of these are included in my info.plist. I have tried nearly 10 times to change the name of my string ranging from long strings (e.g. We get the bluetooth in order to connect with certain DJI models that require bluetooth to get telemetry and other data from the drone.) to short strings (e.g. We display the user's location on Mapview.)
All other questions I have seen claim the simple solution is to include the string, which I'm already doing! Does this have something to do with DJI's sdk? I would think just including this in MY info.plist would be enough. The main issue seems to be with the bluetooth permissions as another app I am trying to upload returns the same issue.
"Dear Developer,
We identified one or more issues with a recent delivery for your app,
"DJI Swift Demo". Please correct the following issues, then upload
again.
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 NSBluetoothPeripheralUsageDescription 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 will be 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).
Though you are not required to fix the following issues, we wanted to
make you aware of them:
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 NSLocationWhenInUseUsageDescription 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 will be 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)."
Instead of verifying the plist information in XCode, please look into the plist inside ipa.
Please follow the below steps to verify plist inside ipa.
Let say, your ipa file is Demo.ipa
Copy the Demo.ipa to DemoBkup.ipa
Rename it to DemoBkup.zip
Extract the zip file. (Double click the zip file)
The Extracted file will contain "Payload" folder.Get into Payload folder.
You will find the Demo package. Right click and tap "Show Package contents"
Search for your Info.plist.
Validate all the information you gave in XCode is present in this plist.
Change your info.plist keys with the keys Privacy - Bluetooth Peripheral Usage Description, Privacy - Location When In Use Usage Description. Check the given screenshot for reference:
Do check the plist file referenced by the scheme you are building. I think the plist file you are making change is not the same referenced by the scheme from what you are building the ipa file to submit to App Store.

App rejected: Missing Info.plist key "NSBluetoothPeripheralUsageDescription" but framework is not present

I have a Cordova app that runs in iOS phones. I'm trying to send an update of this app to App Store, but it is being rejected. Firstly it was rejected because the info.plist contained a line with the key NSBluetoothPeripheralUsageDescription and this feature is never used in my app. To solve this problem I removed this line from info.plist and the respective framework from Linked Frameworks and Libraries in xCode (the framework CoreBluetooth.framework and the line NSBluetoothPeripheralUsageDescription was added by Cordova Diagnostic Plugin), as can be seen in the image below:
However now I'm receiving a e-mail from iTunes Connect saying this:
Missing Info.plist key - This app attempts to access privacy-sensitive
data without a usage description. The app's Info.plist must contain an
NSBluetoothPeripheralUsageDescription key with a string value
explaining to the user how the app uses this data.
But I removed the CoreBluetooth.framework from the xCode project...
My question is: I need to remove this framework from another place? Are some other framework able to use bluetooth causing this problem?
Thanks for help.
Open Info Plist file and press on + sign add new key in info.plist of your project and add this NSBluetoothPeripheralUsageDescription and write value "Explain the reasons for bluetooth"
Check Screen shot below
It appears that you cannot have a generic text string like:
We need access to your bluetooth connection.
I had something like this and got rejected. When I had a more detailed description like:
We need access to your bluetooth connection to upload data from your
device for crash reports.
I was approved.
The descriptions are mandatory for any content you or any frameworks you link against attempt to access. The errors are generated upon an attempt to access the content if a usage description was not supplied, so if you're getting those errors your app must be requesting them. You should discover why your app or its frameworks require these and add appropriate usage descriptions to your app's info.plist.
Or more ideally, if you don't need access, see if there's a way to not request it (or use frameworks that do unnecessarily).
For time being you can add the following descriptions in your info.plist and submit your app (in case of urgent app update)
<key>NSCalendarsUsageDescription</key>
<string>Explain the reasons for accessing...</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Explain the reasons for accessing...</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Explain the reasons for accessing...</string>
Just open your info.plist and add the code above accordingly.
Try to add below in your plist. It solve my problem.
<config-file parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
<string>YourAppName would like to store a photo.</string>
</config-file>
I found this thread because I had the same problem.
My experience was that I had installed a Bluetooth package with cordova, but, the experiment fail, and with the new copiles has this issue.
I checked the package.json, the package-lock.json and that I removed all the refences to my code. But, still falling.
Then I checked the pods bundle and found the Bluetooth bundle, but still failing.
I remove and add the platform ios and still falling.
Then I check the project and in the plugins folder I have the Bluetooth plugins folder. Removed, Compiled and works again.
I hope to help you.

iTunes connect rejects my App after uploading because of missing privacy-access descriptions

I want to upload my app to iTunes connect but after uploading I always get an error message by mail from iTunes, that after their scan some description variables are missing.
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
I am using both features, so that's ok, BUT: i already added those variables to my localized infoPlist.strings. And these seems to work, because in the Simulator and my iPhone, both strings are displayed correctly in the system dialogs. I didn't add the strings to the plist.info file, because I specified them in the localized file, which should be ok. The plist.info and also the localized file are both packaged in the app, I already head a look using Finder.
Is there anything else I must add? Do I still need to add them to the plist.info file, although they are in the localized file?
Additional info: I am using the latest XCode 8 GM build on macOS Safari.
Are you using AdMob? If so the answer is that Google confirmed that it is an issue with the AdMob SDK. You can read about it here.
The solution is, to add the keys also to the PList.info file, not only to the localized infoPlist.strings file.
This is a bit inconsequent because within the simulator and on my phone every message is displayed correctly. But now my app was accepted.

Resources