Our iOS project compiles fine locally (using xCode) but fails on the Unity Cloud Build system. This only started happening when we added the iCloud plugin from Prime31. I’ve asked on their support forum but they said the plugin should be fine and to ask here instead.
Here’s the errors I’m getting:
[xcode] ld: object contains invalid bitcode: ../Assets/Editor/Prime31/iCloud/libiCloudPlugin.a(iCloudBinding.o) for architecture arm64
22110: [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
22111: [xcode] Ld build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/mmk normal armv7
22112: [xcode] cd /BUILDPATH/em-studios-ltd.mmk.iosmmk/temp.kdw2MT
22113: [xcode] export IPHONEOSDEPLOYMENTTARGET=9.1
22114: [xcode] ** BUILD FAILED **
22115: [xcode] The following build commands failed:
22116: [xcode] Ld build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/arm64/mmk normal arm64
22117: [xcode] (1 failure)
It looks like bitcode is somehow missing for the arm64 architecture - Prime31 says the plugin contains all bitcode for the different architectures so I’m not sure what else might be going wrong.
We have a knowledge base article that explains how to disable bitcode via the XCode manipulation API, and in this case you’re likely going to want to do the opposite of that as bitcode is now turned off by default in recent versions of Unity.
You will want to change the the line where the property is set to the following:
Thanks for the info, I’ll give that a go and see how I get on. It’s unusual that it works locally for me though (bitcode compiles fine into the archive file) but doesn’t work on the cloud build.
If you want to setup the xCode project so the final app shows up on the app store with a set of supported languages you can add this to the info.plist:
To do that in code you can modify the plist file in your post build process.
For example, here’s some code I wrote to add the ‘NSAllowsArbitraryLoads’ exception to the plist, you should be able to modify it to do the languages too.
using PlistCS;
{
string plistPath = Path.Combine(buildPath, "Info.plist");
if(!File.Exists( plistPath ))
{
Debug.LogWarning("Couldn't find Info.plist in build output.");
return;
}
// modify plist
Dictionary<string,object> plist = (Dictionary<string,object>) Plist.readPlist(plistPath);
// Add transport security info
Dictionary<string,object> ts = new Dictionary<string,object>();
ts["NSAllowsArbitraryLoads"] = true;
plist["NSAppTransportSecurity"] = ts as object;
Plist.writeXml(plist, plistPath);
}