Skip to main content
Search our knowledge base

How can I disable Bitcode support?

Comments

12 comments

  • Tom Kane

    This was really useful, thanks. We were having issues with our iOS build and this has fixed it.

    0
  • Andrey Dolgov

    Doesn't work on compiling in Cloud Build:

    error CS0234: The type or namespace name 'Callbacks' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
    error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
    error CS0246: The type or namespace name 'BuildTarget' could not be found (are you missing a using directive or an assembly reference?) error CS0246: The type or namespace name 'PostProcessBuildAttribute' could not be found (are you missing a using directive or an assembly reference?) error CS0246: The type or namespace name 'PostProcessBuild' could not be found (are you missing a using directive or an assembly reference?)

    Is there a way to configure Cloud Build to disable bitcode?

    0
  • Edd Smith

    Andrey Dolgov - My guess would be that you've not put the script in an Editor folder which is why it can't find those classes.

    0
  • Doesn't work in 2019.3, xcode doesn't even give you the option to disable bitcode manually.

    I'm using:

    Unity 2019.3.15

    Xcode 11.5

    iOS 13.5

    I'm trying to build an app with easyAR but it always give me this:

    /Frameworks/Plugins/iOS/easyar.framework/easyar(easyar-arm64-master.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target.

    I tried going to the file that it points to and add ENABLE_BITCODE (tried NO and YES) to the Info.plist of the framework but no success.

    Tried all of this in two projecs, one with firebase (generates xcworkspace) and another with easy ar only (generates xcodeproj), both had the same error.

    0
  • Nurullah Morshed

    Elizeu Emanuel Herichs Becker

    The code shown here no longer works due to the way Unity has changed the targets in xcode in Unity 2019.3 and later.

    I made this modification to the code to get it working again.

     

    #if UNITY_IOS
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEditor;
    using UnityEditor.Callbacks;
    using UnityEditor.iOS.Xcode;


    public static class MyBuildPostprocess
    {
    [PostProcessBuild( 1000 )]
    public static void PostProcessBuildAttribute( BuildTarget target, string pathToBuildProject )
    {
    if(target == BuildTarget.iOS)
    {
    string projectPath = PBXProject.GetPBXProjectPath(pathToBuildProject);

    PBXProject pbxProject = new PBXProject();
    pbxProject.ReadFromFile(projectPath);
    string[] targetGuids = new string[2] { pbxProject.GetUnityMainTargetGuid(), pbxProject.GetUnityFrameworkTargetGuid() };

    pbxProject.SetBuildProperty(targetGuids, "ENABLE_BITCODE", "NO");
    pbxProject.WriteToFile (projectPath);
    }
    }
    }
    #endif

     

    2
  • Yuhan Yang

    I'm using uinty2019.4 now and got the "bitcode error". The project only contains an empty scene and a third-party plugin. The method of disabling bitcode works well for unity 2018, but it doesn't work for the unity 2019.4 project. I already switched to the script provided by Nurullah.

    0
  • Nurullah Morshed

    Yuhan Yang did updated script I provide work for you? We migrated away from doing iOS builds after I set up the script so I have not triggered iOS builds in quite a while. However, I am happy to help you troubleshoot it, if it is not working for you.

    0
  • Samuel Bjørn Mumm Jessen

    Nurullah Morshed

    Thanks! This worked for me in unity 2019.4

    0
  • Greg Bradburn

    Greetings, I'm using the modified script from Nurullah in 2020.1.6f1. I need to disable bitcode for the AdMix plugin. Using the latest build from CloudBuild AdMix is not showing ads and I can't tell from the build log if CloudBuild honored the script and disabled bitcode. Any suggestions on how I can confirm if bitcode is disabled in that build?

    Thanks!

    0
  • Nurullah Morshed

    Greg Bradburn Samuel Bjørn Mumm Jessen
    I'm glad it helped :D
    It looks like Unity finally updated their reference script to work with the new APIs as well, so hopefully this isn't a problem for people anymore!

    0
  • Misha Krasnorutsky
    Symptoms:
     
    • I am developing a game for iOS.
    • I want to set ENABLE_BITCODE=NO in the Xcode project as the default setting for an Xcode project exported by Unity.
    • I have several third-party libraries which still do not support Bitcode on iOS. 

    The main problem with bitcode is not listed here. I have never seen libraries without bitcode support. What I see every day are libraries with incompatible bitcode versions.
    Almost every big Xcode release comes with a new clang compiler with a new bitcode version that is incompatible with all the previous versions. New third party libraries with incompatible bitcode versions appear more often than I take a shower.
    Yes, Apple recommends using bitcode. But there are NO practical benefits of using it.

    0
  • Mike

    For those using Unity Cloud Build - there is a config option where you can set a Custom Fastlane configuration. Can we disable bitcode in this way, instead of having to implement `IPostprocessBuildWithReport`?

     

    0

Please sign in to leave a comment.