Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Application.RequestAdvertisingIdentifierAsync returns empty idfa on iOS

Discussion in 'Scripting' started by menelaus, Mar 29, 2020.

  1. menelaus

    menelaus

    Joined:
    Apr 24, 2014
    Posts:
    3
    Hi,

    On recent versions of Unity (Unity 2019.3.6f1, Unity 2018.4.19f1, Unity 2017.4.38f1 ) Application.RequestAdvertisingIdentifierAsync method callback gets empty idfa. It wasn't issue before March Unity releases, I can't find anything on internet and submit bug report last week but nothing happens.

    This is serious issue we're having, anything undocumented changed I'm not aware of or is this a bug with last releases ?

    Thanks,
    Emin
     
  2. andersTheNinja

    andersTheNinja

    Joined:
    May 17, 2018
    Posts:
    17
    Same for me. Happened after updating from 2019.3.3 to 2019.3.7.
    Double checked ”limit ad tracking” setting, it is not enabled.
    @menelaus so you have a bug tracker link?
     
  3. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I've experienced this with 2019.3.7 :(

    Updated to 2019.3.9 and now it appears that I'm getting it correctly again.
    @menelaus and @andersTheNinja , can you also update to 2019.3.9 and check?
    It will raise the confidence level that this isn't just a coincidence...
     
  4. andersTheNinja

    andersTheNinja

    Joined:
    May 17, 2018
    Posts:
    17
    @eladleb4
    Updated to 2019.3.10f1, no luck. Not getting any device Id. Tried resetting id in iOS settings, still nothing.
    Admob is still able to get the correct id, it emits a log message like "use this id to get test ads", with the same string as before. Only Unity itself seems unable to get the ID.
    I created a blank project to test, and it did not work so it's not my project either.
     
    eladleb4 likes this.
  5. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    Same here. Moved from 2018.4.18f1 to 2018.4.21f1, and now I get empty string.
     
  6. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    File a bug report #1242276.

    My assumption this was broken in 2018.4.19f1 and 2019.3.4f1 by fixing #1219457.
     
  7. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I had it working perfectly for a while using 2019.3.9 and then after another app update it stopped working (using the same unity version).
    Now I get the same behavior as I did a month ago.
    @amjad2172005 can you post a link to the issue? Couldn't find it in the issue tracker.. :(
     
  8. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I went back to the working build with 2019.3.9 and it still works properly...
    It could be another component that breaks RequestAdvertisingIdentifierAsync (I'm using firebase and Facebook's SDKs).
     
  9. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I found an interesting lead... Let me know your thoughts.

    I traced back to the single commit where the issue started happening and the only difference was my debug logs.

    When I removed the logs, it stopped working (tracking enabled = false).
    When I included them, it's working (tracking enabled = true and getting an identifier).

    Here is the interesting line:

    Code (CSharp):
    1.  
    2. #if UNITY_IOS
    3. Debug.LogFormat("AdsID  {0}",UnityEngine.iOS.Device.advertisingIdentifier?? "NULL");
    4. #endif
    5.  
    I didn't have any more time to investigate but I suspect it may have to do with code stripping, as I access the iOS.Device.advertisingIdentifer.
    I'll ship a new version with this log included and keep my fingers crossed for now.

    [May 18th update]
    After adding the above I'm getting the advertising identifier as expected.
     
    Last edited: May 18, 2020
  10. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
  11. wofin

    wofin

    Joined:
    May 26, 2017
    Posts:
    1
    @eladleb4 it is reproduced on unity 2017.4.40f1.
    With UnityEngine.iOS.Device.advertisingIdentifier, the RequestAdvertisingIdentifierAsync is working, without Device.advertisingIdentifier, RequestAdvertisingIdentifierAsync return false with an empty error string.

    Has nothing to do with ios14.5. It's reproduced on ios 14.4.2 and 12.5
     
    Last edited: Apr 27, 2021