iOS build failing at the very end for the XCode compiling for obscure reasons

Hi all,

I’m encountering a very strange problem. My cloud iOS builds were working perfectly fine until yesterday, and now they are systematically failing and I don’t see why neither in the compact nor the full log.

The error is the following as shown in the detailed log :

Can someone help me identify the problem ?

Here are the logs :

Compact Log :

Full Log :

Thanks a lot for your help !

NB : Android Cloud Builds are working perfectly fine.

Looking at the full logs, it says at the end that the FacebookSDK you are using was not compiled with bitcode support.

So for this to build while using the FacebookSDK, you will need to use the XCode manipulation API to turn off bitcode for the entire build. Here is a link with sample code on how to do this: Unity 5.3.x build size increase FAQ - Unity Engine - Unity Discussions

Hi Ryan, thank you very much for the help !

It seems to be what I was looking for.

I tried the code snippet you linked but I do not manage to make it work. Those line pose a problem :

string nativeTarget = proj.TargetGuidByName(Xcode.PBXProject.GetUnityTargetName());
string testTarget = proj.TargetGuidByName(Xcode.PBXProject.GetUnityTestTargetName());

Mono gives me an error on the “Xcode” call (doesn’t exist in the context).

Here is the full script I wrote :

using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS;
using UnityEditor.iOS.Xcode;
using System.IO;

public class AntiBitcodePostProcesing : MonoBehaviour {

    [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();
            string nativeTarget = proj.TargetGuidByName(Xcode.PBXProject.GetUnityTargetName());
            string testTarget = proj.TargetGuidByName(Xcode.PBXProject.GetUnityTestTargetName());
            string[] buildTargets = new string[]{nativeTarget, testTarget};

            proj.ReadFromString(File.ReadAllText(projPath));
            proj.SetBuildProperty(buildTargets, "ENABLE_BITCODE", "NO");
            File.WriteAllText(projPath, proj.WriteToString());
        }
    }
}

I tried to remove the “Xcode” call and just call directly to the “PBXProject”.

string nativeTarget = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
string testTarget = proj.TargetGuidByName(PBXProject.GetUnityTestTargetName());

It did not trigger any pre-compilation error but it raised the following error during its execution :

I’m pretty sure I’m very close to the solution but I don’t know what I did wrong.

Any advice ?

Thanks again.

A bit lower on the first page of that thread I linked talks about the changes needed to make the script work. I’ll ping Mantas and have him edit his code snippet to be correct. In the mean time, here is a corrected code snippet I use:

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public static class DisableBitcode
{
    [PostProcessBuild]
    public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
    {
        if (buildTarget != BuildTarget.iOS)
            return;

        string projectPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

        PBXProject project = new PBXProject();
        project.ReadFromString(File.ReadAllText(projectPath));

        string nativeTarget = project.TargetGuidByName(PBXProject.GetUnityTargetName());
        string testTarget = project.TargetGuidByName(PBXProject.GetUnityTestTargetName());
        string[] buildTargets = new string[] { nativeTarget, testTarget };

        project.SetBuildProperty(buildTargets, "ENABLE_BITCODE", "NO");
        File.WriteAllText(projectPath, project.WriteToString());
    }
}