Unity to iOS, info.plist Overwritten After PostProcessBuild2019 Community Moderator ElectionFrom Unity to iOS, how to perfectly automate frameworks, settings and plist?Unity: Sending OSC messages to MSP/PD clientFacebook Unity SDK, broken post processor for iOSDynamically Load and Activate a dataset (vuforia and unity)Not ask user permission to access camera in other languages than Englishhow to support multiple displays Unity UWP appsPhoto capture permission problems in iOS 11iOS 11 not asking permission for access photo from the appUIImagePickerController working without NS Photo Library and Camera descriptionsUnity (Vuforia) project integrated in Android project shows a black screen on startupHow to change camera input(DJI drone camera) in unity and export to android studio

What is the likely impact on flights of grounding an entire aircraft series?

Replacing Windows 7 security updates with anti-virus?

Good allowance savings plan?

Running a subshell from the middle of the current command

What Happens when Passenger Refuses to Fly Boeing 737 Max?

How could a female member of a species produce eggs unto death?

Excess Zinc in garden soil

This equation is outside the page, how to modify it

Straight line with arrows and dots

Deleting missing values from a dataset

Silly Sally's Movie

How does Dispel Magic work against Stoneskin?

Is this animal really missing?

How to make readers know that my work has used a hidden constraint?

What is the blue range indicating on this manifold pressure gauge?

What to do when during a meeting client people start to fight (even physically) with each others?

Time dilation for a moving electronic clock

Gravity alteration as extermination tool viable?

If Invisibility ends because the original caster casts a non-concentration spell, does Invisibility also end on other targets of the original casting?

A curious inequality concerning binomial coefficients

What happens with multiple copies of Humility and Glorious Anthem on the battlefield?

infinitive telling the purpose

Nimitta - sutta references

Force user to remove USB token



Unity to iOS, info.plist Overwritten After PostProcessBuild



2019 Community Moderator ElectionFrom Unity to iOS, how to perfectly automate frameworks, settings and plist?Unity: Sending OSC messages to MSP/PD clientFacebook Unity SDK, broken post processor for iOSDynamically Load and Activate a dataset (vuforia and unity)Not ask user permission to access camera in other languages than Englishhow to support multiple displays Unity UWP appsPhoto capture permission problems in iOS 11iOS 11 not asking permission for access photo from the appUIImagePickerController working without NS Photo Library and Camera descriptionsUnity (Vuforia) project integrated in Android project shows a black screen on startupHow to change camera input(DJI drone camera) in unity and export to android studio










0















Background:



  1. Using Unity 2018.3.5f1 to build iOS Project

  2. Using PostProcessBuild Attribute to change info.plist

  3. Code worked in a different project in Unity 2018.2.1f1

I believe I'm doing what's suggested in this article: From Unity to iOS, how to perfectly automate frameworks, settings and plist?



I've confirmed that the PostBuildProcess function is called and the info.plist is changed. I log the output and it appears correct. I also saved a 2nd file in my code (info2.plist) and it contains all the changes I expect. However, the original file (info.plist) is overwritten with different values.



It seems that Unity is overwriting the info.plist file after the PostProcessBuild functions are running.



Code is placed in /Assets/Editor folder in Unity project.



Here's one of my functions:



[PostProcessBuild(1)]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)

if (buildTarget == BuildTarget.iOS)

// Get plist file and read it.
string plistPath = pathToBuiltProject + "/Info.plist";
Debug.Log("In the ChangeXCodePlist, path is: " + plistPath);
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
Debug.Log("In the ChangeXCodePlist");

// Get root
PlistElementDict rootDict = plist.root;

// Required when using camera for demos, e.g. AR demos.
rootDict.SetString("NSCameraUsageDescription", "Uses the camera for Augmented Reality");

// Required when using photo library in demo (i.e. reading library).
rootDict.SetString("NSPhotoLibraryUsageDescription", "$PRODUCT_NAME photo use");

// Required when adding images to photo library in demos.
rootDict.SetString("NSPhotoLibraryAddUsageDescription", "$PRODUCT_NAME photo use");

//ITSAppUsesNonExemptEncryption, this value is required for release in TestFlight.
rootDict.SetBoolean("ITSAppUsesNonExemptEncryption", false);

Debug.Log("PLIST: " + plist.WriteToString());

// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
File.WriteAllText(pathToBuiltProject + "/info2.plist", plist.WriteToString());











share|improve this question






















  • Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

    – dogiordano
    Mar 6 at 21:25















0















Background:



  1. Using Unity 2018.3.5f1 to build iOS Project

  2. Using PostProcessBuild Attribute to change info.plist

  3. Code worked in a different project in Unity 2018.2.1f1

I believe I'm doing what's suggested in this article: From Unity to iOS, how to perfectly automate frameworks, settings and plist?



I've confirmed that the PostBuildProcess function is called and the info.plist is changed. I log the output and it appears correct. I also saved a 2nd file in my code (info2.plist) and it contains all the changes I expect. However, the original file (info.plist) is overwritten with different values.



It seems that Unity is overwriting the info.plist file after the PostProcessBuild functions are running.



Code is placed in /Assets/Editor folder in Unity project.



Here's one of my functions:



[PostProcessBuild(1)]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)

if (buildTarget == BuildTarget.iOS)

// Get plist file and read it.
string plistPath = pathToBuiltProject + "/Info.plist";
Debug.Log("In the ChangeXCodePlist, path is: " + plistPath);
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
Debug.Log("In the ChangeXCodePlist");

// Get root
PlistElementDict rootDict = plist.root;

// Required when using camera for demos, e.g. AR demos.
rootDict.SetString("NSCameraUsageDescription", "Uses the camera for Augmented Reality");

// Required when using photo library in demo (i.e. reading library).
rootDict.SetString("NSPhotoLibraryUsageDescription", "$PRODUCT_NAME photo use");

// Required when adding images to photo library in demos.
rootDict.SetString("NSPhotoLibraryAddUsageDescription", "$PRODUCT_NAME photo use");

//ITSAppUsesNonExemptEncryption, this value is required for release in TestFlight.
rootDict.SetBoolean("ITSAppUsesNonExemptEncryption", false);

Debug.Log("PLIST: " + plist.WriteToString());

// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
File.WriteAllText(pathToBuiltProject + "/info2.plist", plist.WriteToString());











share|improve this question






















  • Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

    – dogiordano
    Mar 6 at 21:25













0












0








0








Background:



  1. Using Unity 2018.3.5f1 to build iOS Project

  2. Using PostProcessBuild Attribute to change info.plist

  3. Code worked in a different project in Unity 2018.2.1f1

I believe I'm doing what's suggested in this article: From Unity to iOS, how to perfectly automate frameworks, settings and plist?



I've confirmed that the PostBuildProcess function is called and the info.plist is changed. I log the output and it appears correct. I also saved a 2nd file in my code (info2.plist) and it contains all the changes I expect. However, the original file (info.plist) is overwritten with different values.



It seems that Unity is overwriting the info.plist file after the PostProcessBuild functions are running.



Code is placed in /Assets/Editor folder in Unity project.



Here's one of my functions:



[PostProcessBuild(1)]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)

if (buildTarget == BuildTarget.iOS)

// Get plist file and read it.
string plistPath = pathToBuiltProject + "/Info.plist";
Debug.Log("In the ChangeXCodePlist, path is: " + plistPath);
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
Debug.Log("In the ChangeXCodePlist");

// Get root
PlistElementDict rootDict = plist.root;

// Required when using camera for demos, e.g. AR demos.
rootDict.SetString("NSCameraUsageDescription", "Uses the camera for Augmented Reality");

// Required when using photo library in demo (i.e. reading library).
rootDict.SetString("NSPhotoLibraryUsageDescription", "$PRODUCT_NAME photo use");

// Required when adding images to photo library in demos.
rootDict.SetString("NSPhotoLibraryAddUsageDescription", "$PRODUCT_NAME photo use");

//ITSAppUsesNonExemptEncryption, this value is required for release in TestFlight.
rootDict.SetBoolean("ITSAppUsesNonExemptEncryption", false);

Debug.Log("PLIST: " + plist.WriteToString());

// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
File.WriteAllText(pathToBuiltProject + "/info2.plist", plist.WriteToString());











share|improve this question














Background:



  1. Using Unity 2018.3.5f1 to build iOS Project

  2. Using PostProcessBuild Attribute to change info.plist

  3. Code worked in a different project in Unity 2018.2.1f1

I believe I'm doing what's suggested in this article: From Unity to iOS, how to perfectly automate frameworks, settings and plist?



I've confirmed that the PostBuildProcess function is called and the info.plist is changed. I log the output and it appears correct. I also saved a 2nd file in my code (info2.plist) and it contains all the changes I expect. However, the original file (info.plist) is overwritten with different values.



It seems that Unity is overwriting the info.plist file after the PostProcessBuild functions are running.



Code is placed in /Assets/Editor folder in Unity project.



Here's one of my functions:



[PostProcessBuild(1)]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)

if (buildTarget == BuildTarget.iOS)

// Get plist file and read it.
string plistPath = pathToBuiltProject + "/Info.plist";
Debug.Log("In the ChangeXCodePlist, path is: " + plistPath);
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
Debug.Log("In the ChangeXCodePlist");

// Get root
PlistElementDict rootDict = plist.root;

// Required when using camera for demos, e.g. AR demos.
rootDict.SetString("NSCameraUsageDescription", "Uses the camera for Augmented Reality");

// Required when using photo library in demo (i.e. reading library).
rootDict.SetString("NSPhotoLibraryUsageDescription", "$PRODUCT_NAME photo use");

// Required when adding images to photo library in demos.
rootDict.SetString("NSPhotoLibraryAddUsageDescription", "$PRODUCT_NAME photo use");

//ITSAppUsesNonExemptEncryption, this value is required for release in TestFlight.
rootDict.SetBoolean("ITSAppUsesNonExemptEncryption", false);

Debug.Log("PLIST: " + plist.WriteToString());

// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
File.WriteAllText(pathToBuiltProject + "/info2.plist", plist.WriteToString());








ios unity3d post-build-event






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 6 at 17:35









Philip Anthony MusePhilip Anthony Muse

165




165












  • Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

    – dogiordano
    Mar 6 at 21:25

















  • Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

    – dogiordano
    Mar 6 at 21:25
















Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

– dogiordano
Mar 6 at 21:25





Did you look for other PostProcessBuildAttribute with an higher order that could be used by others scripts or libraries you included?

– dogiordano
Mar 6 at 21:25












1 Answer
1






active

oldest

votes


















0














Thanks @dogiordano, that was the problem. A colleague added a library to the project that included a PostProcessBuild attribute with no calling order defined like this:



[PostProcessBuild]



whereas my 2 callbacks had the order specified:
[PostProcessBuild(0)]
[PostProcessBuild(1)]



There's nothing in the doc that describes what happens in this case:
https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html



So, I tried my functions with (1) and (2) to see if the unspecified order would take the (0) slot and it does not. Like this:
[PostProcessBuild] - other library
[PostProcessBuild(1)] - mine
[PostProcessBuild(2)] - mine



So, if you don't specify a callback order, those functions are called after the functions that have an order specified.



I specified the callback order for all 3, and it works as expected.
[PostProcessBuild(0)] - other library
[PostProcessBuild(1)] - mine
[PostProcessBuild(2)] - mine






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55029079%2funity-to-ios-info-plist-overwritten-after-postprocessbuild%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Thanks @dogiordano, that was the problem. A colleague added a library to the project that included a PostProcessBuild attribute with no calling order defined like this:



    [PostProcessBuild]



    whereas my 2 callbacks had the order specified:
    [PostProcessBuild(0)]
    [PostProcessBuild(1)]



    There's nothing in the doc that describes what happens in this case:
    https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html



    So, I tried my functions with (1) and (2) to see if the unspecified order would take the (0) slot and it does not. Like this:
    [PostProcessBuild] - other library
    [PostProcessBuild(1)] - mine
    [PostProcessBuild(2)] - mine



    So, if you don't specify a callback order, those functions are called after the functions that have an order specified.



    I specified the callback order for all 3, and it works as expected.
    [PostProcessBuild(0)] - other library
    [PostProcessBuild(1)] - mine
    [PostProcessBuild(2)] - mine






    share|improve this answer



























      0














      Thanks @dogiordano, that was the problem. A colleague added a library to the project that included a PostProcessBuild attribute with no calling order defined like this:



      [PostProcessBuild]



      whereas my 2 callbacks had the order specified:
      [PostProcessBuild(0)]
      [PostProcessBuild(1)]



      There's nothing in the doc that describes what happens in this case:
      https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html



      So, I tried my functions with (1) and (2) to see if the unspecified order would take the (0) slot and it does not. Like this:
      [PostProcessBuild] - other library
      [PostProcessBuild(1)] - mine
      [PostProcessBuild(2)] - mine



      So, if you don't specify a callback order, those functions are called after the functions that have an order specified.



      I specified the callback order for all 3, and it works as expected.
      [PostProcessBuild(0)] - other library
      [PostProcessBuild(1)] - mine
      [PostProcessBuild(2)] - mine






      share|improve this answer

























        0












        0








        0







        Thanks @dogiordano, that was the problem. A colleague added a library to the project that included a PostProcessBuild attribute with no calling order defined like this:



        [PostProcessBuild]



        whereas my 2 callbacks had the order specified:
        [PostProcessBuild(0)]
        [PostProcessBuild(1)]



        There's nothing in the doc that describes what happens in this case:
        https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html



        So, I tried my functions with (1) and (2) to see if the unspecified order would take the (0) slot and it does not. Like this:
        [PostProcessBuild] - other library
        [PostProcessBuild(1)] - mine
        [PostProcessBuild(2)] - mine



        So, if you don't specify a callback order, those functions are called after the functions that have an order specified.



        I specified the callback order for all 3, and it works as expected.
        [PostProcessBuild(0)] - other library
        [PostProcessBuild(1)] - mine
        [PostProcessBuild(2)] - mine






        share|improve this answer













        Thanks @dogiordano, that was the problem. A colleague added a library to the project that included a PostProcessBuild attribute with no calling order defined like this:



        [PostProcessBuild]



        whereas my 2 callbacks had the order specified:
        [PostProcessBuild(0)]
        [PostProcessBuild(1)]



        There's nothing in the doc that describes what happens in this case:
        https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html



        So, I tried my functions with (1) and (2) to see if the unspecified order would take the (0) slot and it does not. Like this:
        [PostProcessBuild] - other library
        [PostProcessBuild(1)] - mine
        [PostProcessBuild(2)] - mine



        So, if you don't specify a callback order, those functions are called after the functions that have an order specified.



        I specified the callback order for all 3, and it works as expected.
        [PostProcessBuild(0)] - other library
        [PostProcessBuild(1)] - mine
        [PostProcessBuild(2)] - mine







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 3:36









        Philip Anthony MusePhilip Anthony Muse

        165




        165





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55029079%2funity-to-ios-info-plist-overwritten-after-postprocessbuild%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

            Алба-Юлія

            Захаров Федір Захарович