Search Unity

iOS Advertising Identifier rejection FAQ

Discussion in 'iOS and tvOS' started by Mantas-Puida, Feb 3, 2014.

  1. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Recently we received several reports that Apple started rejecting apps that use iOS Advertising Identifier, but do not show advertisements. If you was affected by this issue there are instructions how to remove use of this API from Xcode project produced by Unity.

    1) Locate DeviceSettings.mm file in your Xcode project (you should find it under Classes/Unity/)

    2) Make following modifications there:
    a)Remove following functions:
    Code (csharp):
    1. static id QueryASIdentifierManager()
    2. {
    3. <..>
    4. }
    5. static void QueryAdID()
    6. {
    7. <..>
    8. }
    9. static void QueryAdTracking()
    10. {
    11. <..>
    12. }
    b) Remove following declarations of variables:
    Code (csharp):
    1. static NSString*    _ADID               = nil;
    2. static bool         _AdTrackingEnabled  = false;
    c) Modify implementations of following functions (replace with provided below):
    Code (csharp):
    1. extern "C" const char*  UnityAdvertisingIdentifier()
    2. {
    3. return NULL;
    4. }
    5.  
    6. extern "C" bool         UnityAdvertisingTrackingEnabled()
    7. {
    8. return false;
    9. }
    10.  
    11. static void QueryDeviceID()
    12. {
    13.     if(_DeviceID == nil)
    14.     {
    15.     #if UNITY_PRE_IOS7_TARGET
    16.         if(!_ios70orNewer)
    17.             _InitDeviceIDPreIOS7();
    18.     #endif
    19.  
    20.         // first check vendor id
    21.         if(_DeviceID == nil)
    22.         {
    23.             QueryVendorID();
    24.             _DeviceID = _VendorID;
    25.         }
    26.     }
    27. }

    P.S. many other 3rd party libraries are using this API too, so consider contacting their providers if solution posted above doesn’t help.
    P.P.S. we are working to release this fix ASAP
     
  2. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    P.P.P.S.
    Solution posted above needs to be applied for every fresh build when Xcode project gets replaced from scratch or is deployed to new folder. To make these changes permanent for all future builds you should update master template for this file, which you can find at /Applications/Unity/Unity.app/Contents/PlaybackEngines/iPhonePlayer/iPhone-Trampoline/Classes/Unity
     
  3. Jamie_Rabbit_Choi

    Jamie_Rabbit_Choi

    Joined:
    Feb 8, 2014
    Posts:
    3
    Thx.
    I'll try.
     
  4. Hemant Sharma

    Hemant Sharma

    Joined:
    May 28, 2013
    Posts:
    4
    I want to ask this to Unity that is it confirmed that after changing the DeviceSettings.mm file as you mentioned, apple will not reject the app anymore?
     
  5. Reborn

    Reborn

    Joined:
    Aug 16, 2013
    Posts:
    6
    I tried the above but now I receive compiler errors in Xcode. Please help.

    /Classes/Unity/DeviceSettings.mm:31:13: Function 'QueryDeviceID' has internal linkage but is not defined

    Undefined symbols for architecture armv7:
    "_UnityAdvertisingTrackingEnabled", referenced from:
    IsAdvertisingTrackingEnabled() in libiPhone-lib.a(LibEntryPoint.o)
    HardwareInfoReporter::ReportHardwareInfo() in libiPhone-lib.a(ReportHardware.o)
    "_UnityAdvertisingIdentifier", referenced from:
    GetAdvertisingIdentifier() in libiPhone-lib.a(LibEntryPoint.o)
    HardwareInfoReporter::ReportHardwareInfo() in libiPhone-lib.a(ReportHardware.o)
    "QueryDeviceID()", referenced from:
    _UnityDeviceUniqueIdentifier in DeviceSettings.o
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
     
  6. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I believe, you missed part c) of the instructions.
     
  7. Reborn

    Reborn

    Joined:
    Aug 16, 2013
    Posts:
    6
    You are correct, my bad. Thanks for this solution!
     
  8. intoscienceDing

    intoscienceDing

    Joined:
    Nov 29, 2012
    Posts:
    10
    Our app just got approved this morning by using the method posted here.
     
  9. Hemant Sharma

    Hemant Sharma

    Joined:
    May 28, 2013
    Posts:
    4
    I am using chartboost SDK in my unity3D engine. I am not getting any help from chartboost help community. I am not understanding now that this issue (iAd rejection) is now regarding to chartboost integration or is it bug from Unity iteself. Please help because we are at the submission of the app and getting already very late.
     
  10. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    First, it's not nice to post all in large size font. Second this is not really Unity only issue and Mantas already provided everyone a solution for Unity base code however they are not responsible or can't resolve 3rd party plugin problems. You need to get a solution from Chartboost or you need to stop using it. That means you postpone your release until they fix it or you try to fix it yourself if they provide code or find other product to do the same.

    The problem relates to Apples new policy the enforce the rule they have told about before:

    http://techcrunch.com/2014/02/03/ap...howing-ads-are-being-rejected-from-app-store/
     
  11. luyu822

    luyu822

    Joined:
    Aug 16, 2013
    Posts:
    1
    I tried the solution and used "grep -r advertisingIdentifier ." to test my binary. I got this:

    Binary file ./Data/Managed/UnityEngine.dll matches
    Binary file ./Libraries/libiPhone-lib.a matches
    ./Libraries/RegisterMonoModules.cpp: void Register_UnityEngine_iPhone_get_advertisingIdentifier ();
    ./Libraries/RegisterMonoModules.cpp: Register_UnityEngine_iPhone_get_advertisingIdentifier ();
    ./Libraries/UnityEngine.dll.s:m_wrapper_managed_to_native_UnityEngine_iPhone_get_advertisingIdentifier:
    ./Libraries/UnityEngine.dll.s: plt__icall_native_UnityEngine_iPhone_get_advertisingIdentifier:

    Dose it mean my binary still use iOS Advertising Identifier?
     
  12. Kafke

    Kafke

    Joined:
    Feb 12, 2014
    Posts:
    2
    I've did everything according to the FAQ but when i launch the game (debug mode), splash screen comes up, bloody error comes up (debug mode says that error comes up in "checkBytes" ) how can i fix this?
     
  13. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I believe your error is unrelated. Most probably you are on iOS Free license and have inappropriate splashscreen installed. Maybe you were on iOS Pro trial when started your project?
     
  14. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    You should be fine.
     
  15. Kafke

    Kafke

    Joined:
    Feb 12, 2014
    Posts:
    2
    Yes i'm using iOS Free license and splashscreen set by default. When i follow this faq, my project doesn't work. when i don't it works fine.
     
  16. theprojectabot

    theprojectabot

    Joined:
    Nov 11, 2011
    Posts:
    38
    I get this result when I try to build the build after modifiying the .mm source to what was described.

    Undefined symbols for architecture armv7:
    "_UnityDeviceUniqueIdentifier", referenced from:
    systeminfo::GetDeviceUniqueIdentifier() in libiPhone-lib.a(iPhoneSettings.o)
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
     
  17. theprojectabot

    theprojectabot

    Joined:
    Nov 11, 2011
    Posts:
    38

    I had commented out : extern "C" const char* UnityDeviceUniqueIdentifier()
    block.. dont do that :)
     
  18. MissVi

    MissVi

    Joined:
    Apr 2, 2013
    Posts:
    7
    @Mantas,

    I've already implemented this fix on our project, but at one part, we use SystemInfo.deviceUniqueIdentifier(for Push notification-related purposes). Will this give us trouble if we use the device ID even if we are not using ads on our app?
     
  19. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    With this fix SystemInfo.deviceUniqueIdentifier uses only identifierForVendor, so you should be OK.
     
  20. kjjung92

    kjjung92

    Joined:
    Feb 17, 2014
    Posts:
    1
    my app has to use ad tracking, but doesn't show any ads. After deleting the codes above, will ad tracking still work?
     
  21. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    If you are using iPhone.advertisingIdentifier then after these changes it will return NULL;
     
  22. Donaira Tamulynaite

    Donaira Tamulynaite

    Unity Technologies

    Joined:
    Oct 16, 2013
    Posts:
    2
    Hi, we haven't been able to reproduce the issue on our devices with an empty project and iOS free license.
    Could you please submit your project as a bug report so we could test the issue using your project?
     
  23. sims11tz

    sims11tz

    Joined:
    Nov 20, 2011
    Posts:
    15
    Our app got rejected today :( We have been in contact with chartboost and fiksu ... they advised us to remove their plugins from our project. Sooooo that's really cool and will help us market our game :S :S :S :S :S
     
  24. blindgoat

    blindgoat

    Joined:
    Oct 24, 2012
    Posts:
    31
    Here's some info from speaking with Chartboost, Fisku and Tapjoy yesterday. Our app has all three of their plugins installed because we buy ads from them so our app is advertised on other apps, but no ads show up in our game.

    Chartboost: They are aware of the issue and are working on a fix. For now, either include ads in your app or remove their plugin until a fix is ready.

    Tapjoy: They are aware of the issue and are working on a fix. For now, either 1) Include ads in your app, 2) Monetize with Tapjoy (https://knowledge.tapjoy.com/en/integration/getting-started-guide-for-publishers), 3) Remove the plugin until they make a fix for it, or 4) Appeal the rejection to Apple. They even gave us this quote to send to Apple:
    Fiksu: They are aware of the issue but said only one client (I guess that makes us client number two) has been rejected for this issue. They said you can disable access of the IDFA in their plugin and their systems would fall back to using digital fingerprinting for attribution (they didn't give any steps for how to do this and we aren't taking this route so I would contact them if you want more info). Their recommendation "would be to disable the default Unity access and re-submit with our plugin still in the app".

    Summary: All three say they use the IDFA and Chartboost and Tapjoy said their plugins are basically useless in the current state if you apply the Unity fix described in the original post, so you might as well remove the plugins until fixes are made. Chartboost and Tapjoy said they will be posting more information on their blogs when they have fixes in place.

    Hope this helps someone out there.
     
    Last edited: Feb 20, 2014
  25. AndreaP

    AndreaP

    Joined:
    Dec 28, 2012
    Posts:
    50
    Thanks for sharing! Yesterday the latest update of our game was rejected by Apple (despite the fact that we did not change how we use the advertising identifier); we are going to resubmit with the modified DeviceSettings.mm and without the Chartboost plugin for now.
     
  26. POLYGAMe

    POLYGAMe

    Joined:
    Jan 20, 2009
    Posts:
    196
    Two of my games were just rejected for this, only I have incorporated iAD and want to keep it (no other advertising, though)... what do I remove/not remove? This is REALLY frustrating.

    EDIT: Never mind, it seems that following the above instructions doesn't mess with my iAD stuff... here's hoping the games are accepted this time :S
     
    Last edited: Feb 21, 2014
  27. Vicky Smalley

    Vicky Smalley

    Joined:
    Jan 6, 2014
    Posts:
    4
    Hi,

    Any news when there will be a Unity update to fix this?

    Thanks,
    Vicky
     
    korimako likes this.
  28. prestonf

    prestonf

    Joined:
    Oct 21, 2013
    Posts:
    4
    We also got rejected from AppStore, but I am resubmitting with the temporary workaround. Pain to do it by hand every export, but heres to hoping for a quick fix :D
     
  29. plokkum

    plokkum

    Joined:
    May 28, 2013
    Posts:
    90
    Got rejected for the same reasons as well, but AFTER applying these changes.
     
  30. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Are you using any 3rd party plugins?
     
  31. MobApps

    MobApps

    Joined:
    Aug 5, 2013
    Posts:
    17
    My game is rejected as well, after applying changes.

    I am using AdMob, RevMob and ChartBoost plugins.
     
  32. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    220
    Got rejected as well after applying changes. I am also using Flurry, but it is updated to the last version without AID.
    Another game was approved with the same options (Flurry + fixes from this post) and this one is not, although the reason given by Apple in resolution center is the same - using IAD.
    Searching in the Xcode project for advertisintIdentifier gives this:
    DeviceSettings.mm: extern "C" const char* UnityAdvertisingIdentifier() (it's return null already)
    RegisterMonoModules.cpp
    UnityEngine.dll
    UnityInterface.h
     
  33. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Is your app serving advertisements in way Apple review can see them? Otherwise you might need to supply additional instructions for reviewer.
     
  34. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Maybe Flurry update didn't properly integrate into final Xcode project? Or maybe manual fix was incomplete?
     
  35. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    220
    In that case i think i should see more "advertisintIdentifier" in the search results when i do "Search in project" in Xcode, but i see only results mentioned
    Fix is complete, i checked it.

     
  36. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I doubt Xcode search will find references in compiled Flurry library. You can examine referenced symbols with nm command (like this: "nm flurry.a | grep -i advertisingIdentifier").
     
  37. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    220
    I am using Flurry plugin from Prime 31, and it does all integration automatically.
    And i have another game approved with this version of plugin, so i am out of ideas for now.
     
  38. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Maybe just try cleaning everything / rebuild and resubmit? Otherewise I'm also out of ideas. Btw, you might use nm tool on final binary too, to check if there are any non-scripting references to advertisingIdentifier.
     
  39. AndreaP

    AndreaP

    Joined:
    Dec 28, 2012
    Posts:
    50
    I'm happy to report that our latest update has just been accepted by Apple. The fix to DeviceSettings.mm suggested by Mantas Puida in this thread worked flawlessly for us :) Thanks!
    We also removed the chartboost plugin (as we were not showing ads anyway), just to be safe.
     
  40. fluiddot

    fluiddot

    Joined:
    Aug 27, 2013
    Posts:
    2
    My game was also rejected because this issue.
    I applied the fix and i also remove from "Linked Framework Libraries" the AdSupport.framework as Apple says in the PLA 3.3.12.

    Waiting for the review (crossing my fingers) ...

    Thanks Mantas for the fix ;)
     
  41. MissVi

    MissVi

    Joined:
    Apr 2, 2013
    Posts:
    7
    @Mantas, since we don't show any Ads, should we also delete iAd.framework? Non of our plugins are using this, only Unity.I'm not sure if this will also put us in risk during submission. Please advise. Thanks.
     
    Last edited: Feb 27, 2014
  42. AndreaP

    AndreaP

    Joined:
    Dec 28, 2012
    Posts:
    50
    We didn't and got approved. I don't think iAd.framework uses the advertising identifier, so it should be safe I guess.
     
  43. d.felber

    d.felber

    Joined:
    Sep 19, 2013
    Posts:
    2
    @Unity Team: Can you PLEASE provide a newsletter/warning/notification if such fatal issue appears?
     
  44. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    220
    I executed following command in the build folder:
    find . | grep -v .svn | grep "\.a" | grep -v "\.app" | xargs grep advertisingIdentifier

    and got this

    Binary file ./Libraries/libiPhone-lib.a matches

    What is this lib, can it be the reason of rejection?
     
  45. prestonf

    prestonf

    Joined:
    Oct 21, 2013
    Posts:
    4
    I am wondering the same things as our app just rejected using workaround detailed in the first post. We were hoping to do a major launch but The ad framework has gotten us rejected both times. Is there any update to this issue?
     
  46. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
  47. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    It's a Unity runtime. You are finding scripting <-> native layer binding symbols like "__Z53Register_UnityEngine_iPhone_get_advertisingIdentifierv", which is not what Apple looking at, when checking for IDFA use.
     
  48. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    @prestonf, are you using any of third party plugins?
     
  49. prestonf

    prestonf

    Joined:
    Oct 21, 2013
    Posts:
    4
    @Mantas Puida

    Yup, We are using iGUI for our front-end, Smart Localization for localized text/images, and U3DXT for AddressBook integrations, We also have Facebook SDK 4.3.6, but aside from importing and adding our app id we haven't used it much yet. I will poke around in U3DXT to see if they have something triggering the flag at apple, in my previous look through I don't remember seeing anything but thats not to say I could have glossed over something. If anyone has found workarounds or troubles with the above plugins let me know~ :)

    As a note in U3DXT we are only using Core Personal Address Book/Events/Locations options.

    For reference this is what they are rejecting based on:
    '
    We have verified that your app contains code that is accessing the Advertising Identifier, however, we did not see ads served in your app.
    ...
    - class: ASIdentifierManager
    - selector: advertisingIdentifier
    - framework: AdSupport.framework
    ...
    '

    Results from grep:
    '
    grep -r advertisingIdentifier .
    Binary file ./ios/Data/Managed/UnityEngine.dll matches
    Binary file ./ios/Libraries/libiPhone-lib.a matches
    ./ios/Libraries/RegisterMonoModules.cpp: void Register_UnityEngine_iPhone_get_advertisingIdentifier ();
    ./ios/Libraries/RegisterMonoModules.cpp: Register_UnityEngine_iPhone_get_advertisingIdentifier ();
    ./ios/Libraries/UnityEngine.dll.s:m_wrapper_managed_to_native_UnityEngine_iPhone_get_advertisingIdentifier:
    ./ios/Libraries/UnityEngine.dll.s:plt__icall_native_UnityEngine_iPhone_get_advertisingIdentifier:
    '
     
    Last edited: Mar 3, 2014
  50. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Plugins are typically integrating themselves directly from original location on Unity project tree. So running grep only against Xcode project might not catch them. Try running it against whole Unity project.