public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { Debug.LogWarning("IphoneX Fiter"); if (target != BuildTarget.iOS) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } // Create a new project object from build target UnityEditor.iOS.Xcode.PBXProject project = new UnityEditor.iOS.Xcode.PBXProject(); string configFilePath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(pathToBuiltProject); project.ReadFromFile(configFilePath); string targetGuid = project.TargetGuidByName("Unity-iPhone"); string debug = project.BuildConfigByName(targetGuid, "Debug"); string release = project.BuildConfigByName(targetGuid, "Release"); project.AddBuildPropertyForConfig(debug, "CODE_SIGN_RESOURCE_RULES_PATH", "$(SDKROOT)/ResourceRules.plist"); project.AddBuildPropertyForConfig(release, "CODE_SIGN_RESOURCE_RULES_PATH", "$(SDKROOT)/ResourceRules.plist"); project.AddFrameworkToProject(targetGuid, "SystemConfiguration.framework", true); project.AddFrameworkToProject(targetGuid, "Security.framework", true); project.AddFrameworkToProject(targetGuid, "libz.tbd", true); project.AddFrameworkToProject(targetGuid, "libc++.tbd", true); project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); project.WriteToFile(configFilePath); EditSuitIpXCode(pathToBuiltProject); }
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); }