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

Other 2022.2.0b4 produced disabled bitcode error on iOS

Discussion in '2022.2 Beta' started by VentaGames, Aug 8, 2022.

  1. VentaGames

    VentaGames

    Joined:
    Jul 9, 2021
    Posts:
    128
    Just tried to build the project for iOS and got the following error:
    Does it mean that i need new Xode14 (where apple deprecates bitcode) for future builds?
    Or it just a bug?

    Thanks.
     
  2. paavann

    paavann

    Joined:
    Nov 21, 2018
    Posts:
    33
    Hi, @VentaGames I am getting the same issue on 2022.2.1f1. Did you find the fix of the above issue. Please let me know.
    Thanks in advance.
     
  3. VentaGames

    VentaGames

    Joined:
    Jul 9, 2021
    Posts:
    128
    Hi, yes, there are two solutions:
    1. manually disable it in Xcode for both targets, UnityFramework and Unity_iPhone.
    (Xcode->build settings-> search for bitcode and set 'Yes' to 'No'.

    2. Place the following code to the Editor folder (Assets/Editor/)
    Code (CSharp):
    1. #if UNITY_IOS
    2. using UnityEditor;
    3. using UnityEditor.Build;
    4. using UnityEditor.Build.Reporting;
    5. using UnityEditor.iOS.Xcode;
    6. using UnityEngine;
    7.  
    8. namespace Editor
    9. {
    10.     public class IOSPostProcessing: IPostprocessBuildWithReport
    11.     {
    12.         public int callbackOrder => 0;
    13.      
    14.         public void OnPostprocessBuild(BuildReport report)
    15.         {
    16.             //Fixme: not needed as this IS iOS
    17.             if (report.summary.platform != BuildTarget.iOS)
    18.                 return;
    19.  
    20.             var projectPath = report.summary.outputPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
    21.  
    22.             var pbxProject = new PBXProject();
    23.             pbxProject.ReadFromFile(projectPath);
    24.  
    25.             //Main Target
    26.             var target = pbxProject.GetUnityMainTargetGuid();
    27.             pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    28.          
    29.             //Unity Tests
    30.             target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
    31.             pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    32.          
    33.             //Unity Framework
    34.             target = pbxProject.GetUnityFrameworkTargetGuid();
    35.             pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    36.          
    37.             pbxProject.WriteToFile(projectPath);
    38.         }
    39.     }
    40. }
    41. #endif
    42.  
    The second method works for every new build.
    The first solution you have to do is for every export you make.
    For me, it works like a charm.
     
  4. paavann

    paavann

    Joined:
    Nov 21, 2018
    Posts:
    33
    Hi @VentaGames Thanks for the reply. I will use the above fix to resolve my issue.