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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Unity 2019 + Xcode 14: Bitcode errors when building

Discussion in 'iOS and tvOS' started by waldgeist, Sep 22, 2022.

  1. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    I tried to build my existing Unity 2019.4.40 app with Xcode 14, but ran into build errors due to missing Bitcode. After searching on Apple's forums, I found out that this can be resolved by enabling Bitcode for all build targets under the Pods project, but it is pretty annoying to do this manually after any build. Can this be automated somehow?
     
    tthibault likes this.
  2. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
  3. tthibault

    tthibault

    Joined:
    Oct 5, 2021
    Posts:
    3
    I'm having the same issue on Unity 2020.3.39 with a project that was working before I upgraded to Xcode 14. I get the Bitcode build error for one of the 3rd party Pods I'm using
     
  4. tthibault

    tthibault

    Joined:
    Oct 5, 2021
    Posts:
    3
    I added the following to my podfile until this can be resolved. I only needed it for one target. You could remove the if check if you need it for more than a named target.

    post_install do |installer|
    installer.pods_project.targets.each do |target|
    if target.name == "MSAL"
    puts "Processing for enable bit code"
    target.build_configurations.each do |config|
    config.build_settings['ENABLE_BITCODE'] = 'YES'
    end
    end
    end
    end

     
    waldgeist likes this.
  5. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    How do you modify the podfile from within Unity?
     
  6. tthibault

    tthibault

    Joined:
    Oct 5, 2021
    Posts:
    3
    waldgeist likes this.
  7. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    Thanks for the clarification!
     
  8. KyleFormella

    KyleFormella

    Joined:
    Jul 19, 2018
    Posts:
    7
    @waldgeist Thanks for opening this thread. I attempted to update to latest 2020 LTS hoping Unity introduced a fix, but alas no.

    I had a separate question; are you also finding that the Xcode project created by Unity no longer retains the "Display Name", "Version", and "Build" anymore? I only recently updated to Xcode 14.
     
  9. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    Oh. Just checked this with Unity 2019.4, and yes: these infos are indeed missing. Any more "surprises"?
     
  10. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    Damn. I knew I should never update to the latest macOS. Now I am forced to use Xcode 14 or downgrade my Mac again.
     
  11. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    260
    Still missing any info why Xcode is all of the sudden requiring Bitcode?
     
  12. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    55
  13. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    55
    Fixed all my builds by doing this:
    Code (CSharp):
    1.  
    2.     [PostProcessBuild(999)]
    3.     public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    4.     {
    5.         if (buildTarget != BuildTarget.iOS)
    6.         {
    7.             return;
    8.         }
    9.  
    10.         var projPath = PBXProject.GetPBXProjectPath(path);
    11.  
    12.         var project = new PBXProject();
    13.         project.ReadFromFile(projPath);
    14.  
    15.         var mainTargetGuid = project.GetUnityMainTargetGuid();
    16.  
    17.         foreach (var targetGuid in new[] {mainTargetGuid, project.GetUnityFrameworkTargetGuid()})
    18.         {
    19.             project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
    20.         }
    21.  
    22.         project.WriteToFile(projPath);
    23.     }
     
    gilzoide and gamefish like this.
  14. gamefish

    gamefish

    Joined:
    Jul 5, 2013
    Posts:
    14
    Confirm this resolved my problem, since there is no “Enable Bitcode” in building settings in xcode 14, this process will add that option there for every target
     
  15. Paracetamlol

    Paracetamlol

    Joined:
    Sep 25, 2019
    Posts:
    2
    Where to add that code?

    Guys please give few more details, not everyone is an experience developer
     
  16. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    55
    Simply add this as .cs script anywhere in Assets folder