Search Unity

Resolving the iOS Advertising Identifier rejection issue via Cloud Build!?

Discussion in 'Unity Build Automation' started by tomph, Feb 26, 2020.

  1. tomph

    tomph

    Joined:
    Nov 6, 2013
    Posts:
    33
    Hi!

    So there is currently a long standing issue where iOS apps are getting rejected for Advertising ID issues if they are being published into the Kids category. My app has been rejected 7-8 times... Anyway, this thread (https://forum.unity.com/threads/ios-advertising-identifier-rejection-faq.226187/) describes how you can manually edit the DeviceSettings.mm file from an iOS build to get around the issue.

    However... As I'm using UCB I can't just edit the file! I've tried doing this with a postbuild shell script, but that happens after the IPA is compiled, which is too late.

    I have an edited version of DeviceSettings.mm in my project, which I am hoping to simply copy & replace the one that UCB has generated.

    Has anybody managed to do something like this? Is it even possible?

    (tagging you because you have both provided semi-related help on other threads)
    @Mantas-Puida @victorw
     
  2. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    You should be able to make this modification via a post-export script. We also support (and recommend) usage of fastlane for modifications to iOS/Android project build configurations however I did not see any actions available there for this specific scenario.
     
    tomph likes this.
  3. tomph

    tomph

    Joined:
    Nov 6, 2013
    Posts:
    33
    Yeah I thought this might be the case. Do you know how I would get to the file I need (DeviceSettings.mm) from
    OnPostprocessBuild? I only ask because trial and error via a 1-hour build time is getting tedious! :)
     
  4. tomph

    tomph

    Joined:
    Nov 6, 2013
    Posts:
    33
    Something like this? (I'm storing my edited DeviceSettings in StreamingAssets folder)


    Code (CSharp):
    1. private static void PostBuildIOS(string projectPath)
    2. {
    3.     string dest = projectPath + "/Classes/Unity/DeviceSettings.mm";
    4.     string source = projectPath + "/Data/Raw/DeviceSettings.mm";
    5.  
    6.     FileUtil.ReplaceFile(source, dest);
    7. }
     
  5. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    I don't think the source there will work, since the project path refers to the location of the exported xcode project. Dest is probably correct though. My inclination would be to perform the modifications on the file directly via text replacement.