Search Unity

Bug Empty NSUserTrackingUsageDescription causes warning from App Store

Discussion in 'Localization Tools' started by UnityUser_21, Sep 2, 2022.

  1. UnityUser_21

    UnityUser_21

    Joined:
    Apr 18, 2019
    Posts:
    10
    Hey,

    We have been using the Localization plugin successfully to localize the NSUserTrackingUsageDescription, but now we started to get this warning when an iOS build is uploaded to App Store. We have the version 1.2.1, but this also affects the newest version 1.3.2.

    ITMS-90738: Invalid value for purpose string - The value “” for Info.plist NSUserTrackingUsageDescription is not allowed in the app. Your app‘s code references one or more APIs that access sensitive user data. The app‘s Info.plist file should contain a NSUserTrackingUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.​

    The problem is that during the post process build phase in Player.WriteLocalizedValue method the default value of NSUserTrackingUsageDescription gets set to an empty string, and this overwrites any value set by our own build post processor code earlier in the build process.

    The localized strings for NSUserTrackingUsageDescription end up in the Xcode project correctly, its just the empty NSUserTrackingUsageDescription field value in the Info.plist that causes the warning.

    NSUserTrackingUsageDescription could be filled manually in the Xcode project, but since our build pipeline is automated it would cause manual work. We'll try to solve this by affecting the post process build callback order and set the empty NSUserTrackingUsageDescription to a non-empty one, but I wanted to let you know about this issue.
     
    khalilyamoun_99707 and damelin like this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Are you using the LocalizationPackage to localize the app info?
    My understanding is that we need to set the field to an empty string in order for it to use localized values. If it's empty then it should be using the localized value for the current language.
    I think you should be assigning the default to the English table instead and using that as the final fallback.
     
  3. UnityUser_21

    UnityUser_21

    Joined:
    Apr 18, 2019
    Posts:
    10
    Thanks for the quick reply!

    Yes.

    We were able to get rid of the App Store warning by setting a non-empty string to NSUserTrackingUsageDescription after Localization Package's Player.WriteLocalizedValue sets it empty with plistDocument.root.SetString(valueName, string.Empty).

    If you take a look at the Player.WriteLocalizedValue you can see that the fallback behaviour doesn't change the fact that the Info.plist's root NSUserTrackingUsageDescription value is set to empty. I tested by defining fallback locales and they work as expected, assigning the fallback locale's value if the current locale's value is eg. empty, but it doesn't change the fact that the root NSUserTrackingUsageDescription is set to empty.

    If the root NSUserTrackingUsageDescription is suppose to be empty in the case where there are localised strings available in the project then it's quite weird for App Store to complain about that.
     
    Andrey-Shapuro likes this.
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Yes that's strange. Are you able to file a bug report so we can look into this? I think it would help us to see a sample project so we can better understand how you are using it.
     
  5. UnityUser_21

    UnityUser_21

    Joined:
    Apr 18, 2019
    Posts:
    10
    Our QA was able to confirm that the localised strings are used correctly in the App Tracking Transparency popup with the build where a non-empty value was added to the root NSUserTrackingUsageDescription field, so everything I see here points to that it shouldn't be set empty.

    Unfortunately I can't send any project files to external partners. I hope you have here enough information to start taking action at your side.
     
    damelin likes this.
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    ok ill look into it. Thanks
     
  7. khalilyamoun_99707

    khalilyamoun_99707

    Joined:
    Oct 5, 2022
    Posts:
    2
    We're currently facing the same issue
    Did you find a solution to fix the warning ?
     
  8. UnityUser_21

    UnityUser_21

    Joined:
    Apr 18, 2019
    Posts:
    10
    Two possible solutions are:
    Build Xcode project from Unity, open Xcode project and set string to "Privacy - Tracking Usage Description" field and then build the app in Xcode.

    Or if you want to automate it, make a build post processing script and in the OnPostProcessBuild method modify Info.plist file by setting a non-empty string to NSUserTrackingUsageDescription field. You will need to make the post processing script to run after the Unity localization plugin's own post processing script. You can affect the call order by adding a [PostProcessBuild] attribute with a number indicating the callback priority at the top of your OnPostProcessBuild method, eg. [PostProcessBuild(2)].
     
    CameronND likes this.
  9. khalilyamoun_99707

    khalilyamoun_99707

    Joined:
    Oct 5, 2022
    Posts:
    2
    Went with option #2 - All good now, thanks :)