Search Unity

PRODUCT_NAME_APP in User-Defined Settings not correct

Discussion in 'iOS and tvOS' started by Karry-su, Apr 30, 2021.

  1. Karry-su

    Karry-su

    Joined:
    Nov 23, 2015
    Posts:
    7
    Hello,
    When building project to a Xcode project, Unity will generate a user-defined setting named 'PRODUCT_NAME_APP' in project.pbxproj file. In the past, it used the last part of my bundle identifier as the value of PRODUCT_NAME_APP. (I am not sure if this is the logic, but the value just equals to the last part of bundle identifier.) But after I upgraded Unity Version from 2020.1.0f1 to 2020.3.1f1, The value always be 'ProductName'.

    But when I use 2020.3.1f1 to create a new project and build it to a xcode project, the value does equals to the last part of bundle identifier. So I don't know what's wrong within my old projects. Why cannot it generate the value of PRODUCT_NAME_APP.
     

    Attached Files:

  2. JacekCi

    JacekCi

    Joined:
    Feb 23, 2018
    Posts:
    6
    +1 as I see the same. We updated the project from Unity 2019 to 2020.3.12f1 and our ipa file has a different name.

    Please let me know if you found a solution for this.
     
  3. Karry-su

    Karry-su

    Joined:
    Nov 23, 2015
    Posts:
    7
    I cannot find any official solution. So, I write a script to replace 'ProductName' to what I want.
    Code (CSharp):
    1. public class iOSPostProcessBuild
    2. {
    3.     [PostProcessBuildAttribute(0)]
    4.     public static void OnPostprocessBuild(BuildTarget target, string path){
    5.         if(target==BuildTarget.iOS){
    6.             string pbxProjectPath = PBXProject.GetPBXProjectPath(path);
    7.             string pbxProjectContent = File.ReadAllText(pbxProjectPath);
    8.             pbxProjectContent = pbxProjectContent.Replace(
    9.                 "PRODUCT_NAME_APP = ProductName;", "PRODUCT_NAME_APP = myappname;");
    10.             File.WriteAllText(pbxProjectPath, pbxProjectContent);
    11.         }
    12.     }
    13. }
     
    rivereast likes this.
  4. Dargon_huihui

    Dargon_huihui

    Joined:
    Mar 23, 2016
    Posts:
    9
    thank you ! I cannot find any solution too