- Home /
Unity Cloud Build. How to set ENABLE_BITCODE for iOS?
My project was building fine until today on Unity Cloud build. Not sure what changed. I'm using Unity 5.1.3f and the cloud project is set to using "Latest version of Xcode".
16097: [xcode] ld: '/BUILD_PATH/xxxxxx.xxxxxx.default-ios/temp.IQkMVM/Libraries/libiPhone-lib.a(GameCenter.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. for architecture arm64 16098: [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation) 16099: [xcode] ** BUILD FAILED **
I know how to disable this flag in XCode, but how do I do it in Unity/Cloud build so that ENABLE_BITCODE is set to FALSE?
Edit. I thought ENABLE_BITCODE was supposed to be set to True, but it was supposed to be set to false. I'm not sure why this problem cropped up, but I figured out a solution for it. Added an answer.
Answer by psykojello2 · Jan 31, 2016 at 06:44 PM
I'm not sure why this suddenly stopped working, but i fixed it using a post build script.
Note that I ran into another error when uploading the .ipa file to iTunesConnect: “Invalid Bundle. iPad Multitasking support requires these orientations: ‘ UIInterfaceOrieentationPortrait,UIInterfaceOrientationPortraitUpsideDo........."
Added a fix to the info.plist at the end of this post build function:
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;
public class BL_BuildPostProcess
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string target = proj.TargetGuidByName("Unity-iPhone");
proj.SetBuildProperty(target, "ENABLE_BITCODE", "false");
File.WriteAllText(projPath, proj.WriteToString());
// Add url schema to plist file
string plistPath = path + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
// Get root
PlistElementDict rootDict = plist.root;
rootDict.SetBoolean("UIRequiresFullScreen",true);
plist.WriteToFile(plistPath);
}
}
}
Here is an official post form Unity Support about it https://support.unity.com/hc/en-us/articles/207942813-How-can-I-disable-Bitcode-support-
Answer by hexagonius · Jan 30, 2016 at 02:01 PM
Looks like 5.3.2 addresses the issue:
Tried building with 5.3.2 on cloudbuild and I got the same error.
I know there's a way to run a postbuild to set this flag, but I can't find an example of usage.
A year later, I know, but for the curious folks who stumble on this looking for an answer to their problem:
5.3.2 addressed this issue - but not in a way that was meant to solve it. Unity is complying with Apple's guidelines and encouraging their users to take additional steps if they want not to comply. Think of it like a safety switch - ins$$anonymous$$d of an "enable bitcode" switch somewhere, they're making it so you have to take extraordinary steps to turn bitcode support off.
I'd prefer a checkbox hidden in Player Settings somewhere, but I'm using a script similar to the above for cloud builds these days.
I encounter this problem continually with two packages: Vuforia and ffmpeg. (And for other things that include ffmpeg). OpenCV also presents this problem.
Apple wants things submitted with bitcode enabled. They've suggested that they will eventually not allow apps to be submitted which don't contain bitcode - and indeed watchOS and tvOS already require it. It basically allows them to recompile relevant portions of your project as new OS releases and various devices demand. PTC has their own reasons for not supporting bitcode yet. ffmpeg will support it by including a couple additional flags to build with bitcode in the config.
--extra-cflags=-fembed-bitcode --extra-cxxflags=-fembed-bitcode
If you search online for "ffmpeg" and that line above, you'll find several discussions with a more complete suggested build config.
Your answer
![](https://koobas.hobune.stream/wayback/20220612062250im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UnityCloudBuildProjectId not set in info.plist (iOS) 0 Answers
How easily can you build and create a scene in Unity Cloud and run it on a native Xcode project? 0 Answers
Unity Cloud Build. Player export failed.Reason: 'pod' command not found; 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
iOS Unity Cloud Build failed when 'Target minimum iOS version' is set to 9 0 Answers