Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Check Link Map file to get insight when Kids Category App rejected for using advertisingIdentifier a

Discussion in 'iOS and tvOS' started by PavelLU, Sep 9, 2020.

  1. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    This post describes an additional check routine that can help you to get insight with Link Map file when Kids Category App rejected on App Store for using advertisingIdentifier and/or isAdvertisingTrackingEnabled reason.


    Problem outlined:
    Blacklisted API/symbols/literals causing rejection:
    • advertisingIdentifier
    • isAdvertisingTrackingEnabled
    These are part of AdSupport.framework that have a single class ASIdentifierManager with these properties. They can be called dynamically via selectors at run time or statically at compile/link time.

    Typical Unity generated Xcode Projects consists from hundreds of source files:
    • libiPhone-lib.a, libil2cpp.a, source code, ...etc (core engine)
    • Packages source code / static / dynamic libraries / frameworks
    • 3rd party plugins source code / static & dynamic libraries / frameworks
    Not all symbols defined/used in the project go to final product and many of the symbols you are not aware about go to final product:
    • If symbol/literal is defined in a source/object file it might be dead stripped during compilation/linking time and will be excluded from the final product (except dynamic library)
    • If a particular symbol/literal egz.“ASIdentifierManager” or “advertisingIdentifier” is not used in libiPhone-lib.a/Unity core engine it still might be added to the final product because your project uses related functionality directly or indirectly via Packages or 3rd party plugins through API Unity provides or ASIdentifierManager class directly.
    To ensure your product does not use blacklisted API you need to check each binary within the product directly or via link map file (a preferred way if available) for that binary.
    Please note: Product might have multiple binaries: main executable and/or embedded dynamic libraries/frameworks, check every one of them. Take a look at How to find binaries to check section.
    Please note: Unity 2019.3+ will have UnityFramework.framework
    Please note: Different Xcode Actions/schemas have different build settings thus producing different products and different link map file. For the test use exactly the same steps to build the product you plan to submit to the Apple Store.

    What is a link map file and why to use it?
    Link Map file: is a text file generated by linker, it shows each and every symbol/string literal that is included or excluded in a linked binary, it also keeps track of the object file where this symbol is originated from. This helps more precisely locate the source of the issue.
    Please note: There might be more than one link map file one for each architecture - check every one of them.
    Please note: Generation of Link Map file is enabled by default for Unity generated Xcode project.
    Warning: Do not expose a Link Map file publicly without ensuring it does not include any sensitive information.

    Check routine:
    Check each binary in your product, it will be:
    1. Compiled and linked from source (link map file available)
    2. Provided as pre-build dynamic/framework library (no link map file available)
    1. Link Map file available:
    run:
    egrep -in "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"  "{PATH_TO_LINK_MAP_FILE}"


    A. Look for an exact match against blacklisted API, as in this example:
    ...
    90130:0x100B4374A 0x00000016 [ 43] literal string: advertisingIdentifier
    90132:0x100B4376B 0x0000001D [ 43] literal string: isAdvertisingTrackingEnabled
    ...


    If there is an exact match, check origin [43] in this case (Each symbol has its object index that is mapped to a specific file. Look in the first section of the link map file) to figure out the source of the issue and fix it. In this example it was DeviceSettings.o, This is source file DeviceSettings.mm, check for a fix. (Hint: Set breakpoint there and check call stack it might lead you to "plugin" that is calling it).
    Please Note: you might have multiple exact match hits on blacklisted API, you need to fix all of them​

    B. In this example there is an exact match but symbols are <<dead>> stripped and code it is not part of the binary, nothing to worry about.
    ...
    133105:<<dead>> 0x0000001C [ ...] literal string: advertisingIdentifier
    133175:<<dead>> 0x0000001C [ ...] literal string: isAdvertisingTrackingEnabled
    ...


    C. In this example there is a partial match, expected not to cause rejection.
    ...
    42839:0x10070FD30 0x00000010 [ 65] _AdvertisingIdentifierCallback__ctor_m1A910EA539DCB47425754139A7ABC1957B819B72
    ...

    D. In this example AdSupport framework is used but not the blacklisted API itself, this looks suspicious. If you don't have an A. case and still rejected it is worth fixing this.
    ...
    60501:0x1009D0CA8 0x0000002F [ ...] literal string: /System/Library/Frameworks/AdSupport.framework
    60502:0x1009D0CD7 0x00000014 [ ...] literal string: ASIdentifierManager
    ...

    2. Link Map file is not available, check binary:
    A. run:
    strings -a "{PATH_TO_BINARY}" | egrep "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"

    Look for exact match against blacklisted API, If there is a red exact match you need to solve it, as in this example:
    ...
    advertisingIdentifier
    isAdvertisingTrackingEnabled

    ASIdentifierManager
    ...

    B. run:
    nm -am "{PATH_TO_BINARY}" | egrep "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"

    Look for for ASIdentifierManager usage:
    ...
    (undefined) external _OBJC_CLASS_$_ASIdentifierManager (from AdSupport)
    ...

    If you don't have a red match in step A. but have this one and got rejected you most likely need to solve this.
    How to fix it ?:
    Trackback blacklisted API usage to the plugin/origin and:
    • if it's binary/static lib: check if a newer version of a plugin is available that addresses this issue if not you probably need to consider excluding this plugin from a build.
    • if source code file: patch source in the way to not use blacklisted API. As for DeviceSettings.mm like this fix. (assuming plugin continue to work "correctly")

    If nothing above helps it is worth to check:
    1. Binary is not linked against AdSupport
    run:
    otool -L "{PATH_TO_BINARY}" | grep AdSupport.framework

    /System/Library/Frameworks/AdSupport.framework/AdSupport (compatibility version 1.0.0, current version 1.0.0)
    To fix: consider to remove framework from linking or upgrade/remove plugin​


    How to find binaries to check ?:
    You can use xcarhive file to find binaries to check, run:
    find "{PATH_TO_XCARHIVE}/Products" -type f -exec file "{}" \; | grep "Mach-O"

    For empty Unity 2019.3+ project expected to have 2 hits on: executable and shared library
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/plntest21: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O executable arm_v7] [arm64:Mach-O 64-bit executable arm64]
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/plntest21 (for architecture armv7): Mach-O executable arm_v7
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/plntest21 (for architecture arm64): Mach-O 64-bit executable arm64
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/Frameworks/UnityFramework.framework/UnityFramework: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O dynamically linked shared library arm_v7] [arm64]
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/Frameworks/UnityFramework.framework/UnityFramework (for architecture armv7): Mach-O dynamically linked shared library arm_v7
    2020-09-14 09.28.xcarchive/Products/Applications/plntest21.app/Frameworks/UnityFramework.framework/UnityFramework (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64





     
    Last edited: Sep 18, 2020
    Jonsi and AakashDP like this.
  2. restauranttttt

    restauranttttt

    Joined:
    Aug 6, 2020
    Posts:
    15
    update:
    my path is "*.ipa", where I export my app
    is it correct?
    2.A run "string -a "{path_to_binary}"" shows nothing
    B. run "nm -am "{path_to_binary}"" still returns
    The file was not recognized as a valid object file

    run: "otool -L" shows nothing
    ------------------------
    I run the 3 commands you provide for a '*****-LinkMap-normal-arm64.txt', here are the results
    1.egrep -in "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled" "{PATH_TO_LINK_MAP_FILE}"
    it shows 'capture1' in attachment.

    2. strings -am "{PATH_TO_LINK_MAP_FILE}" | egrep "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"
    first there isn't -am exist, I followed tips, I run 'strings -a', and it shows:
    [338] _Device_get_advertisingIdentifier_mB7E371DD9A612E1EA9D34BA151A5B0C26AF941A0

    [338] _Device_get_advertisingIdentifier_m273AE3092E4E57909CFADBCCC8E5708A91E06448

    3.nm -am "{PATH_TO_LINK_MAP_FILE}" |
    egrep "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"
    tried 'nm -am' or 'nm -a', both error :
    The file was not recognized as a valid object file

    I did not find exact strings you list up there in "capture1".
    Can you look into it?
    thank you
     

    Attached Files:

    Last edited: Sep 11, 2020
    ArderkuDrPanda likes this.
  3. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @restauranttttt, Link Map shows that this binary is NOT using blacklisted API.

    I fixed commands for 2 part (thanks for pointing it out). Can you re-run this part again and run an extra check( added at the end of the original post).
    Are there any other binaries in the final product or just one?


     
  4. restauranttttt

    restauranttttt

    Joined:
    Aug 6, 2020
    Posts:
    15
    I updated the original post.
    I only export a .ipa.
    what binaries do you mean? in build folder or somewhere else?
     
  5. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @restauranttttt for a second part commands you need to run them against {PATH_TO_BINARY} file (not {PATH_TO_LINK_MAP_FILE}), can you please test it again, check the additional section "How to find binaries to check:".
     
  6. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    @Pavelu I have check with the Link Map file. In that file both UnityAdvertisingIdentifer and UnityAdvertrisingTrackingEnabled are present.

    [QUOTE
    0x0002A3C0 0x00000004 [ 39] _UnityAdvertisingIdentifier
    0x0002A3C4 0x00000004 [ 39] _UnityAdvertisingTrackingEnabled
    0x0002A3C8 0x000001CC [ 39] _UnityVendorIdentifier
    0x0002A594 0x000001A8 [ 39] _UnityDeviceName
    0x0002A73C 0x000001A8 [ 39] _UnitySystemName
    0x0002A8E4 0x000001A8 [ 39] _UnitySystemVersion
    0x0002AA8C 0x0000018C [ 39] _UnityDeviceModel
    0x0002AC18 0x00000064 [ 39] _UnityDeviceCPUCount
    [/QUOTE]


    1) In Package manager we dont have any ads package manager.
    2) We have followed the post mentioned . ( changed the class DeviceSettings.mm ) mentioned by unity technologies.
    3) I have tick the Disable HW Statititics in Project Settings.
    both UnityAdvertisingIdentifer and UnityAdvertisingTrackingEnabled are present. Thats the reason for our app rejection.
    4)Actually I have doubt in the framework Adsupport.framework - DoNotEmbed option defaultly present in the xcode file. I have removed the framework . But it shows the error.

    I have a doubt.Did it creates problem in publishing the build in os. Even i saw many Ad files in the xcode files.

    Only Unity Peoples can answer the above questions. Kindly help me to publish my build.

    What i have to do Further ...

    Thanks in Advance
     
    Last edited: Oct 14, 2020
  7. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @Alexander21 UnityAdvertisingIdentifier and UnityAdvertisingTrackingEnabled should not be a problem there is something else.
    Please show commands you executed, have you tested binaries as described in 2. part?
     
  8. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Hi PaveILU thanks for you reply...

    I have run the below commands.

    The output is

    I have attached the file with it.

    I have created ipa file.(Binary File means ipa... Is it correct). I have tested with the following commands.

    When i run the above command. Nothing happens.Just it comes to the prompt.

    it shows the error "The file was not recognized as a valid object file. "You have mentioned in this post. that you have fixed the command. But it shows the same error. so kindly look upon this.
    it shows nothing. It think it grep AdSupport.Framework.


    So what i have to do. still now we have not submitted to apple.

    These are the outputs.What i have to do further..
     
    Last edited: Oct 15, 2020
    ArderkuDrPanda and AakashDP like this.
  9. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @Alexander21
    in link map file there is 2 symbols you get rejected for:
    208461:0x01C41A9F 0x00000016 [1526] literal string: advertisingIdentifier
    208463:0x01C41AC7 0x0000001D [1526] literal string: isAdvertisingTrackingEnabled
    check steps in 1.A section of main post

    IPA is not an executable binary. Archive your project, check "How to find binaries to check?" section of main post
     
  10. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Hi PaveILU

    Thanks for ur reply..We have done the above changes and once again we submit the build to ios and once again our app has been rejected.

    we have archived our project and done the above changes.The Same output has come.

    Even we have removed Ad Framework from the framework library xcode.

    Once again our app has been rejected. So Only UNITY PEOPLES can answer this.
     
  11. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @Alexander21
    can you please go through all check steps once again, and send me a file: with commands executed and output, please double-check that you do this on the same/latest archive you uploaded/got rejected.
     
  12. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Hi Pavelu

    Thanks For your reply..When i google about remove of IDFA Plugin.I have found this solutions.

    Everyone thinks that the advertisingidentifer,AnalyticsIdentifier will be in UnityAds or in UnityAnalytics.But the result shows in my app is. It Present in UNITY GAME ANALYTICS PLUGIN...

    When i give the below command. It shows that the AdIdentifer in GameAnalytics Plugin..So Kindly run this below command. It shows the advertisingIdentifer in your project.

    it gives the below output.

    I think this one is the problem For Rejection for our app. So Once again i check with the below command.

    It shows the output is.


    I have created Adhoc ipa file. I have tested with the following commands.

    When i run the above command. Nothing happens.Just it comes to the prompt.

    it shows error.


    No output...

    Still now we have not submitted the build . Because we need GameAnalytics support. So Unity Peoples Kindly answer my queries.

    Did Unity GameAnalytics contains advertisingIdentifier. that results for the rejection for my app...

    @pavelu if i submit my app without GameAnalytics. Did our app got approved because unity ad identifer is not present without Gameanalytics...

    So kindly UNITY Peoples answer my questions.

    Did Unity GameAnalytics contains advertisingIdentifier. that results for the rejection for my app...
     
    Last edited: Oct 28, 2020
  13. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    107
    @Alexander21
    1. your last link map file looks clean, framework binar is not using blacklisted API
    2. when you have match in
    Code (CSharp):
    1. grep -lr “advertisingIdentifier” * | grep -v .svn | grep -v .md
    it does not mean that all symbols from *.a will land in executable, final answer is in link map file
    3. ipa is not executable its a package with multiple files inside, that's why you don't have an output for commands that expecting binary as input
    please create .xcarchive and run
    Code (CSharp):
    1. find "{PATH_TO_XCARHIVE}/Products" -type f -exec file "{}" \; | grep "Mach-O"
    to find all executable, then run these commands for each executable

    lets see your findings on binaries, last link map file looks ok...
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    FYI GameAnalytics is not Unity. It is more likely this https://gameanalytics.com/
     
  15. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    @Pavelu our App got Approved. I have removed that plugin . Now our app got approved. I have one question

    Which Analytics i can use in unity. I want to export raw data. At present did analytics allowed in ios kids category?
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    That was me. Regardless, you can try Unity Analytics. Keep in mind that Raw Data Export with Unity Analytics requires a Pro license. You can also check out deltaDNA, recently acquired by Unity. I'm not familiar with the pricing however. We can't comment on Apple policies because they keep changing. But at a minimum you will likely need to check the options during submission to state that you are collecting this information.
     
  17. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Thanks JeffDUnity3d for your reply....I will keep my Update....
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Happy to assist!
     
  19. lo2w0

    lo2w0

    Joined:
    Jun 15, 2018
    Posts:
    4
    Hi all!

    I've checked binary files in the xcarchive of my Unity game for kids.
    And I found advertisingIdentifier in the Unity.framework

    Code (CSharp):
    1. $ strings -a "Unity-iPhone 04.12.2020, 12.19.xcarchive/Products/Applications/default.app/Frameworks/UnityFramework.framework/UnityFramework" | egrep "ASIdentifierManager|AdSupport.framework|advertisingIdentifier|isAdvertisingTrackingEnabled"
    2.  
    3. advertisingIdentifier
    4.  
    5. isAdvertisingTrackingEnabled
    6.  
    7. __hidden#334954___ir_hidden#226___ir_hidden#36980_OBJC_CLASS_$_UIDevice__ir_hidden#38253___ir_hidden#12___ir_hidden#36919___ir_hidden#13___ir_hidden#36920_OBJC_CLASS_$_NSString__ir_hidden#37803___ir_hidden#332___ir_hidden#36984_OBJC_CLASS_$_USRVDevice__ir_hidden#37717___ir_hidden#16___ir_hidden#36923___ir_hidden#17___ir_hidden#36924___CFConstantStringClassReference__ir_hidden#716___ir_hidden#180___ir_hidden#240___ir_hidden#36988___ir_hidden#241___ir_hidden#242___ir_hidden#24___ir_hidden#36990_OBJC_CLASS_$_ASIdentifierManager__ir_hidden#37764___ir_hidden#314___ir_hidden#37048___ir_hidden#245___ir_hidden#36928___ir_hidden#246___ir_hidden#37049___ir_hidden#315___ir_hidden#37050_OBJC_CLASS_$_USRVConnectivityUtils__ir_hidden#37719___ir_hidden#249_
    I use Unity 2019.4.13f1
    What should I do in this case? Apple doesn't approve my update of this kids game
     
  20. lo2w0

    lo2w0

    Joined:
    Jun 15, 2018
    Posts:
    4
    UPDATE: I've resolved my issue.

    Unity Ads and Unity Analytics were enabled in the Package Manager. I removed it and now everything is clean.
    Also I've disabled "Crashes and exceptions" in the Cloud diagnostics
     
    Last edited: Dec 4, 2020
  21. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Hi Unity Team

    I am using 2018.4.28.When i try to build My project. and i have replaced the Devicesettings.mm file. When i run the xcode i am receiving the error.


    When i search the forum i have found this forum.

    https://issuetracker.unity3d.com/is...l-memory-under-report-available-device-memory

    is it a bug in unity 2018..4.28. because in oct 2020. I have build successfully and upload to itunes.

    When i changed the devicesettings.mm only the above error came. without changing devicesettings.mm file the build is successful.

    What i have to do to solve this error. shall i have to upgrade for 2019 to solve this error .or any solutions is there.[
     
  22. Casio

    Casio

    Joined:
    Jul 16, 2012
    Posts:
    28
    So I have done exactly as instructed and found that Unity is still including and blacklisted API references. Here is the results of my grep (btw using Unity 2020.30f (so no this has not been addressed by any updating):

    77227:0x00CA14B0 0x00000016 [1483] literal string: advertisingIdentifier
    77228:0x00CA14C6 0x0000001D [1483] literal string: isAdvertisingTrackingEnabled

    135463:<<dead>> 0x00000048 [635] __Z52Application_CUSTOM_RequestAdvertisingIdentifierAsyncP37ScriptingBackendNativeObjectPtrOpaque
    138472:<<dead>> 0x00000014 [635] __Z66Register_UnityEngine_Application_RequestAdvertisingIdentifierAsyncv
    142437:<<dead>> 0x0000003B [635] literal string: UnityEngine.Application::RequestAdvertisingIdentifierAsync
    [1483] /Users/Casio/Desktop/Wee Princess Treasures/BUILD/Frameworks/Plugins/iOS/UnityAds.framework/UnityAds(UnityAds)

    Looking at the LinkMap shows this is from:
    [1483] /Users/Casio/Desktop/Wee Princess Treasures/BUILD/Frameworks/Plugins/iOS/UnityAds.framework/UnityAds(UnityAds)

    How do we prevent these from being included in the app so we can go back to getting things approved as normal?
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show a screenshot of your included Package Manager packages
     
  24. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Haven't been able to update my kids app because of this.
    will there be a solution that doesn't require all this?
     
  25. beaver_derek

    beaver_derek

    Joined:
    Mar 17, 2021
    Posts:
    1
    I have a few questions about this thread.

    I wonder if this thread represents a method for when the issue occurs in a project that does not use UnityAds.
    If so, do you know how to deal with this issue when it occurs in kids category apps including Unity Ads?

    Currently, we are reviewing apps in the kids category for iOS, but we are constantly being rejected.

    When I contacted the Unity Ads team, they were told to solve it through this link, but it look like a solution for an app that does not use Unity Ads.

    I use Unity 2019.4.11f and advertisement package 4.0.0 on Unity Package Manager.
     
  26. Casio

    Casio

    Joined:
    Jul 16, 2012
    Posts:
    28
    Jeff here are the packages. The only item that we know of that contains references to the blacklisted items in question is UNITY ADS. We have confirmed that without Unity Ads we do not have the banned IdTrackers.
    upload_2022-3-8_20-39-28.png
    It is my understanding that the request has been made many times to the UnityAds team to remove these references to enable devs to publish games using UnityAds but without calls to AsIdentifierManager. You've been around for quite a while and I am hopeful you may be able to shed some good news?
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It's my understanding that Unity Ads requires those APIs, as evidenced in the defines in devicesettings.mm. I'm not sure if Apple allows ads in children's games.