- Home /
Question by
GordonWedge · Aug 25, 2017 at 03:32 PM ·
unity 5iosxcode
xcodesettingspostprocesser
Hi, i've made a script to modify some xcode project setting after unity build.
public class XcodeSettingsPostProcesser
{
[PostProcessBuildAttribute(0)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject)
{
// Stop processing if targe is NOT iOS
if (buildTarget != BuildTarget.iOS)
return;
// Initialize PbxProject
var projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject pbxProject = new PBXProject();
pbxProject.ReadFromFile(projectPath);
string targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");
pbxProject.UpdateBuildProperty(targetGuid, "Enable Objective-C Exceptions", new string[] { "Yes" },new string[] { "No" });
// Apply settings
File.WriteAllText(projectPath, pbxProject.WriteToString());
}
}
specifically i wanna set "Enable Objective-C Exceptions" to Yes. But instead update the settings, i've got a new setting parameter (equals to the original one) with Yes setted. Obviously xcode continue to take the original one : (
any suggestion?
Comment