public static void PatchXcodeProject (string pathToBuiltProject)
{
PBXProject project = new PBXProject();
string projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
projectPath = checkPBXProjectPath(projectPath);
project.ReadFromFile(projectPath);
string guid = project.TargetGuidByName("Unity-iPhone");
project.AddFrameworkToProject(guid, "ExternalAccessory.framework", false);
// The following settings lead to a quicker build
string releaseConfig = project.BuildConfigByName(guid, "Release");
project.SetBuildPropertyForConfig(releaseConfig, "DEBUG_INFORMATION_FORMAT", "dwarf");
project.SetBuildPropertyForConfig(releaseConfig, "ONLY_ACTIVE_ARCH", "YES");
// XCode7 enables BitCode for all projects by default. Neither the Structure SDK nor Unity support BitCode at this time
project.SetBuildPropertyForConfig(releaseConfig, "ENABLE_BITCODE", "NO");
string debugConfig = project.BuildConfigByName(guid, "Debug");
project.SetBuildPropertyForConfig(debugConfig, "ENABLE_BITCODE", "NO");
project.WriteToFile(projectPath);
}