Search Unity

Disabling BitCode

Discussion in 'iOS and tvOS' started by Eric-Laberge, Jan 7, 2016.

  1. Eric-Laberge

    Eric-Laberge

    Joined:
    Jan 20, 2011
    Posts:
    26
    Hello!

    We are updating our game to Unity 5.3, and, unfortunately, some 3rd party libraries don't currently provide bitcode support.

    As we are using an automated build pipeline, it isn't convenient to manually disable bitcode support through XCode.

    Is there a supported way to configure the build pipeline to disable this feature?
     
  2. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
  3. Eric-Laberge

    Eric-Laberge

    Joined:
    Jan 20, 2011
    Posts:
    26
    I'll keep that for future reference.

    I made a dumb post process script for now:
    Code (CSharp):
    1. public static class DisableBitCode
    2. {
    3.     [PostProcessBuild(100)]
    4.     public static void OnPostProcessBuild( BuildTarget target, string path )
    5.     {
    6.         if ( target == BuildTarget.iOS )
    7.             ProcessXCodeProject( path );
    8.     }
    9.  
    10.     static void ProcessXCodeProject( string filePath )
    11.     {
    12.         if ( !Directory.Exists( filePath ) )
    13.         {
    14.             Debug.LogWarning( "Path does not exists." );
    15.             return;
    16.         }
    17.  
    18.         if ( filePath.EndsWith( ".xcodeproj", System.StringComparison.Ordinal ) == false )
    19.         {
    20.             var projects = Directory.GetDirectories( filePath, "*.xcodeproj" );
    21.             if ( projects.Length == 0 )
    22.             {
    23.                 Debug.LogWarning( "Error: missing xcodeproj file" );
    24.                 return;
    25.             }
    26.  
    27.             filePath = projects[0];  
    28.         }
    29.  
    30.         var projectFilePath = Path.Combine( filePath, "project.pbxproj" );
    31.         var contents = File.ReadAllText( projectFilePath );
    32.  
    33.         contents = Regex.Replace( contents, @"ENABLE_BITCODE\s+=\s+YES;", "ENABLE_BITCODE=NO;" );
    34.  
    35.         File.WriteAllText( projectFilePath, contents );
    36.     }
    37. }