5

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.

Xcode showing Purpose Strings are lost in Info.plist after archiving

I think that something goes wrong when exporting so that the values are cleared?

Pinolpier
  • 467
  • 4
  • 13

2 Answers2

10

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.

Pinolpier
  • 467
  • 4
  • 13
0

In My case this issue come

ITMS-90683: Missing purpose string in Info.plist - Your app’s code references one or more APIs that access sensitive user data, or the app has one or more entitlements that permit such access. The Info.plist file for the “Runner.app” bundle should contain a NSPhotoLibraryUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. 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. For details, visit: https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources.

Use this line of code in your info.plist file

<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to your photo library to upload and share photos within the app.</string>
Safal Bhatia
  • 245
  • 2
  • 6