Search Unity

NSLocationWhenInUseUsageDescription required for unknown reasons

Discussion in 'iOS and tvOS' started by AbeGellis, Apr 26, 2018.

  1. AbeGellis

    AbeGellis

    Joined:
    Dec 16, 2016
    Posts:
    7
    I attempted to upload my project to iTunes Connect, but was notified that my upload had failed for the following reason:

    Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data.

    A previous upload from a different branch of the project went fine (without any such info.plist key), leading me to believe I've unintentionally introduced some kind of location service call in the current branch. I don't use or want to use Unity's LocationService anywhere in the project, and there are no references to it anywhere in my code or in anything I've included. Additionally, the branch that failed to upload was primarily focused on a UI/data reporting overhaul, and I can't figure out what that could possibly reference to trigger this requirement.

    For the time being I've added the key to my info.plist but I'd much prefer that my app didn't erroneously appear to require location data. Is there anything specific that I may have unintentionally done to require this? Or is there anything I can do to identify the cause?

    For reference, my project is built in C# with Unity 2017.3.1f1.
     
  2. tomerpeledNG

    tomerpeledNG

    Joined:
    Jul 14, 2017
    Posts:
    81
    I'm encountering the same issue
     
  3. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    This just showed up yesterday afternoon for our project - but I don't believe we made any code or build changes. We have never used location services (though sometimes I need to chase them out of plugins).
    Maybe something Apple just started detecting/enforcing wrong?
    Unity 5.6.5f1
    xcode 9.2
    Is there a bug filed? If not I can create one.
     
    MoeBull likes this.
  4. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
  5. itarradellas

    itarradellas

    Joined:
    Oct 12, 2016
    Posts:
    1
    Same problem here, just yesterday we were starting to see this... without any change in our location services.
     
  6. AbeGellis

    AbeGellis

    Joined:
    Dec 16, 2016
    Posts:
    7
    Good to know it's not something I broke then. Sounds like it's unrelated to the branch I switched to.

    I haven't filed one yet, please do and link it here.
     
  7. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I added FireBase Analytics to my project yesterday and got the same thing, thought it was related. Interesting.
     
  8. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
  9. jtokash

    jtokash

    Joined:
    Sep 1, 2013
    Posts:
    23
    Seems to be fixed now. My binaries are not being rejected anymore.
     
  10. ktoshiiio

    ktoshiiio

    Joined:
    Mar 24, 2016
    Posts:
    1
    I had the same problem but I tried to upload ipa to iTunesconnect again.
    I've received success email from apple. Yeah seems like it's been fixed now.
    But my TestFlight couldn't connect to iTunesConnect instead..
     
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I also encountered this yesterday. solved it by actually adding those fields to the info.plist - should i remove them? what do you think would be the best option? (in case this was actually resolved from Apple's end)
     
  12. BinaryBanana

    BinaryBanana

    Joined:
    Mar 17, 2014
    Posts:
    81
    I got it today on the latest ARCore 1.2 and ARKit 1.5 app. It wasn't asking for it before and the code didn't change so much.
     
  13. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    Same here, it was not there before when we submit our apps, but we got this message yesterday.

    What happened?
     
  14. dcdemars

    dcdemars

    Joined:
    May 18, 2012
    Posts:
    22
    I just starting seeing this yesterday. I submitted two different iOS apps built with Unity for TestFlight. App Store Connect accepted the binaries but sent me an email for each app flagging this problem. The version of Unity I am using is 2018.2.5f1.
     
  15. unity_2iM-Z6ouvzLZoQ

    unity_2iM-Z6ouvzLZoQ

    Joined:
    Mar 23, 2018
    Posts:
    5
    I encountered the same problem today.
    I found requestWhenInUseAuthorization in iPhone_Sensors.mm in iOS build folder.
    Maybe, App Store Connect found this call and send issues to us.
    Is this safe that I comment out this call?
     
    MoeBull likes this.
  16. MoeBull

    MoeBull

    Joined:
    Feb 11, 2016
    Posts:
    6
    I have the same issue and recently upgraded to 2018.2.5 but I can't confirm that it happened immediately after updating Unity.
     
  17. MoeBull

    MoeBull

    Joined:
    Feb 11, 2016
    Posts:
    6
    iPhone_Sensors.mm has
    #import <CoreLocation/CoreLocation.h>
    but it's been there for builds that did not get the warning so I'm not sure what this new iTunesConnect warning is from
     
  18. ChrisAlgoo

    ChrisAlgoo

    Joined:
    Jul 31, 2013
    Posts:
    2
    I'm running into this too.
     
  19. sekari

    sekari

    Joined:
    Jan 13, 2015
    Posts:
    27
    I just updated a new build to testflight and ran into this issue. I believe Unity automatically adds Core Location library, therefore Apple requires a description as a new rule. I think we should add the description and move on.
     
  20. sschilp

    sschilp

    Joined:
    Jul 12, 2016
    Posts:
    12
    Same issue here.
    Build is good on testflight but we receive the mail from apple as a 'warning' basically telling us to add the string.

    Obviously i could add something to the plist file but i have no clue what to add as i am not actively using any location services or api's.

    So yeah, if anyone has an idea what plugin or part of code is using that, I'd be interested.
     
  21. tucom

    tucom

    Joined:
    Dec 23, 2015
    Posts:
    1
    I just add the Facebook SDK to my project, and I received this mail for the first time I push my build, so I think facebook SKD may be the issue in my case, I wonder if the facebook analytic is the reason? as I see, it's is enable when I active my facebook application.
     
  22. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    Same to me although we don't need that permission and don't add any new change. Is there any way to check which line of code request this permission?
     
  23. EdwinLyons

    EdwinLyons

    Joined:
    Oct 4, 2012
    Posts:
    84
    I'm also having this issue - noticed it after upgrading to Unity 2018.2.4 from 2018.1.5. As we need to submit soon - and don't have a good reason to have this permission, it's a fairly big issue for us.
     
  24. nanagamesstudio

    nanagamesstudio

    Joined:
    Sep 4, 2018
    Posts:
    2
    I'm running into this too.
     
  25. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    Unity includes `CoreLocation/CoreLocation.h` in all cases when building an app for iOS, Apple previously did not require location usage description string if the location API was not actually used but it seems that this will change. Currently they only send warnings so this should not affect the actual submissions of apps made with Unity to the App Store until next year.

    We'll have a fix for this (CoreLocation will only be included in the Xcode project when UnityEngine.LocationService is used) in Unity 2018.3 beta branch in the following weeks, it will be backported to other releases up to 2017.4 but I can't give an exact time estimate on when will that happen.
     
  26. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    Well... since yesterday it's not an only warning anymore and Apple is rejecting binaries because of this.
     
  27. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @wagenheimer this is fixed in 2018.2.12f1 and 2017.4.13f1. But they did say this is only going to be a cause for rejection from spring 2019 previously. Could you share the message you got from Apple?
     
  28. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    @PauliusP I received this just after I sent the Binary, and the Binary was rejected.

    The message says Spring 2019, but the Binary is declined and I cannot submit for approval.
     
    Last edited: Nov 7, 2018
  29. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Do you mean that it is already fixed in 2018.2.12f1? I couldn't find a note in the changelog....
     
  30. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    Seems that we forgot to add it to the 2018.2.12 release notes... But changes should have landed there.

    @wagenheimer if for any reason you can't update to a newer Unity version which has the fix, it's relatively simple to patch the generated Xcode project to no longer use CoreLocation. You'd need to apply the attached diffs and also remove CoreLocation.framework from the project either manually or with https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.RemoveFrameworkFromProject.html in a editor postprocessor script.
     

    Attached Files:

  31. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Is there a way out-of-the-box to apply the scripts in a postprocessor script?
     
  32. EdwinLyons

    EdwinLyons

    Joined:
    Oct 4, 2012
    Posts:
    84
    @Hosnkobf Notice that your rejection message is referring to NSCalendarsUsageDescription. This is not the same as NSLocationWhenInUseUsageDescription that this thread is about.

    This might be a new check added by Apple.

    It might also require another fix from Unity.

    Or it might be something specific to your project? Are you using the calendar (it seems unlikely!)
     
  33. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Good point... not for me but for @wagenheimer
     
  34. EdwinLyons

    EdwinLyons

    Joined:
    Oct 4, 2012
    Posts:
    84
    Good point - sorry for mixing you two up! :)
     
    Hosnkobf likes this.
  35. sschilp

    sschilp

    Joined:
    Jul 12, 2016
    Posts:
    12
    So i updated to Unity 2018.2.14 yesterday. (I was using 2018.2.2 before)
    After the update my xcode builds are now failing with:

    Code (JavaScript):
    1. Undefined symbols for architecture arm64
    2. Symbol: _OBJC_CLASS_$_CLLocationManager
    3. Referenced from: objc-class-ref in iPhone_Sensors.o
    4. ld: symbol(s) not found for architecture arm64
    Could anyone tell me if this is connected to that patch and how i can solve that problem?
    Side-note: I am doing automated command line builds which means that i can not just go into the xcode project and change settings before the xcode builds starts.
    If i need to change settings, i'd need to find a way to do that for every build automatically from command line.
     
  36. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @EdwinLyons thanks for pointing this out, I did not it notice as well. AFAIK NSCalendarsUsageDescription should only be required when using EventKit and we don't include it in Unity out of the box. @wagenheimer do you have any other plugins in your project that might require it?

    @Hosnkobf unfortunately no. But you should be able to apply it by calling `patch` from an external process.
     
  37. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    103
    sorry for being noob, just started iOS development. can you please explain how can I patch Xcode project manually? what to do with those diffs files, any help will be appreciated.
     
  38. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    do you want to patch it manually or via the API?
    For manual patching - just open the generated Xcode project and modify whatever you need.
     
  39. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Where do we need to add those .txt files in xcode?
     
  40. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    I am getting this warning from Apple, as others have stated. Does anyone know if using Input.location will cause this warning?
     
  41. TigerFish89

    TigerFish89

    Joined:
    Jan 6, 2016
    Posts:
    3
    Hi, Thank you for your answer. But I have a question. My team project using unity version 5.6.3p2. So I follow your instruction that patched maully mm files using your diff files. And I tried to remove CoreLocation framework using RemoveFrameWorkFromProject. But it is not work. I checked xcode project path. Could you tell what am I miss? here is code.
    Code (CSharp):
    1.  
    2.     [PostProcessBuild(102)]
    3.     public static void OnPostProcess(BuildTarget in_buildTarget, string in_buildPath)
    4.     {
    5. var proj_path = PBXProject.GetPBXProjectPath(in_buildPath);
    6.         var proj = new PBXProject();
    7.         proj.ReadFromFile(proj_path);
    8.  
    9.         var target_name = PBXProject.GetUnityTargetName();
    10.         var target_guid = proj.TargetGuidByName(target_name);
    11.  
    12.         proj.RemoveFrameworkFromProject(target_guid, "CoreLocation");
    13. }
     
    Last edited: Apr 25, 2019
  42. arjenveenhuizen

    arjenveenhuizen

    Joined:
    Jan 12, 2017
    Posts:
    5
    Looks like you forgot to write your proj file at the end of your script:

    Code (CSharp):
    1. proj.WriteToFile(projPath);
     
  43. bfreitag

    bfreitag

    Joined:
    Oct 24, 2013
    Posts:
    1
    We are getting this as well, under Unity 2017.4.25f1. Did the fix accidentally get moved out?

     
  44. nravibabu

    nravibabu

    Joined:
    Jul 13, 2018
    Posts:
    1
    Code (CSharp):
    1. //The extension of the filename must be ".framework".
    2. proj.RemoveFrameworkFromProject(target_guid, "CoreLocation.framework");
    3. proj.WriteToFile(proj_path);
     
  45. datagreed

    datagreed

    Joined:
    Sep 17, 2018
    Posts:
    44
    I just got it in 2018.3 - I thought it has the patch?
     
  46. Manumoi

    Manumoi

    Joined:
    Oct 31, 2014
    Posts:
    10
    just got it in with unity 2019.1.11f1 ... an almost similar build (just removed useless prefabs from a scene) got accepted by apple 2 days ago
     
  47. mneko23

    mneko23

    Joined:
    Feb 25, 2018
    Posts:
    1
    was using 2018.3.4 didnt get the rejection now using 2018.4.5 and reciving emails
     
  48. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Got a notification about this from Apple this morning on our newly submitted iOS build, using Unity 2019.2.17f1.

    UPDATE: However, they completed processing the build for selection to submit for Review so I guess it was just a warning and we can proceed.
     
    Last edited: Jan 3, 2020
  49. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Currently I'm using 2018.4.12 but I still have ITMS-90683: Missing Purpose String in Info.plist file should contain a NSLocationAlwaysUsageDescription key with a user-facing purpose string. Is that engine bug again?

     
  50. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70
    Unity 2019.2.16f1 and the same ITMS-90683 error any tips ?