These errors have been driving me nuts! ios - How to fix Xcode 6.1 error while building IPA - Stack Overflow
So I created a post-processing script that does the fix for me! It’s short enough that I’ve pasted the code below as well as attached it. Put it in Assets/Editor/FixResourceRules.cs. Warning: it’s not very smart and may break in the future. I’ve used it on three projects so far.
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using System.Collections.Generic;
public static class FixResourceRules {
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuildProject) {
var pbxPath = pathToBuildProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
// Debug.Log(pbxPath);
if (!File.Exists(pbxPath)) {
Debug.LogError("Bailing, unable to open pbpxproj at path " + pbxPath);
return;
}
var ls = File.ReadAllLines(pbxPath);
var lines = new List<string>(ls);
var output = new List<string>();
var i = 0;
foreach (var line in lines) {
output.Add(line);
if (line.Contains("CLANG_CXX_LIBRARY = \"libstdc++\";")) {
Debug.Log("FixResourceRules adding CODE_SIGN_RESOURCE_RULES_PATH = \"$(SDKROOT)/ResourceRules.plist\"; after line " + i + ": " + line);
output.Add(" CODE_SIGN_RESOURCE_RULES_PATH = \"$(SDKROOT)/ResourceRules.plist\";");
}
i++;
}
File.WriteAllLines(pbxPath, output.ToArray());
}
}
1896550–122166–FixResourceRules.cs (1.02 KB)