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); }
private static void EditorIOSAutoBuild(string buildPath) { #if UNITY_IOS var dummy = ScriptableObject.CreateInstance <XCodePostProcess>(); var file = dummy.m_entitlementsFile; ScriptableObject.DestroyImmediate(dummy); if (file == null) { return; } var proj_path = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(buildPath); var proj = new UnityEditor.iOS.Xcode.PBXProject(); proj.ReadFromFile(proj_path); // target_name = "Unity-iPhone" var target_name = UnityEditor.iOS.Xcode.PBXProject.GetUnityTargetName(); var target_guid = proj.TargetGuidByName(target_name); var src = AssetDatabase.GetAssetPath(file); var file_name = Path.GetFileName(src); var dst = buildPath + "/" + target_name + "/" + file_name; FileUtil.CopyFileOrDirectory(src, dst); proj.AddFile(target_name + "/" + file_name, file_name); proj.AddBuildProperty(target_guid, "CODE_SIGN_ENTITLEMENTS", target_name + "/" + file_name); proj.WriteToFile(proj_path); #endif }
private static void EditXcodeProject(string buildFolder) { PBXProject project = new PBXProject(); string path = Path.Combine(buildFolder, FileUtil.NiceWinPath("Unity-iPhone.xcodeproj/project.pbxproj")); project.ReadFromFile(path); string targetGuid = project.TargetGuidByName(PBXProject.GetUnityTargetName()); if (AdvertisementSettings.enabled && AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.IPhonePlayer)) { string target = Path.Combine(buildFolder, Path.Combine("UnityAds", "UnityAds.framework")); FileUtil.CopyDirectoryRecursive(Path.Combine(extensionPath, FileUtil.NiceWinPath("Editor/Resources/iOS/builds/UnityAds.framework")), target, true); project.AddFileToBuild(targetGuid, project.AddFile(Path.Combine("UnityAds", "UnityAds.framework"), "Frameworks/UnityAds.framework", PBXSourceTree.Source)); project.AddBuildProperty(targetGuid, "FRAMEWORK_SEARCH_PATHS", "$(SRCROOT)/UnityAds"); project.AddFrameworkToProject(targetGuid, "AdSupport.framework", true); project.AddFrameworkToProject(targetGuid, "StoreKit.framework", false); project.AddFrameworkToProject(targetGuid, "CoreTelephony.framework", false); } else { project.RemoveFile(project.FindFileGuidByRealPath(Path.Combine("UnityAds", "UnityAds.framework"))); string[] removeValues = new string[] { "$(SRCROOT)/UnityAds" }; project.UpdateBuildProperty(targetGuid, "FRAMEWORK_SEARCH_PATHS", null, removeValues); string str5 = Path.Combine(buildFolder, "UnityAds"); if (Directory.Exists(str5)) { Directory.Delete(str5, true); } } project.AddFileToBuild(targetGuid, project.AddFile("UnityAdsConfig.h", "Classes/UnityAds/UnityAdsConfig.h")); project.WriteToFile(path); }
private static void PostProcessIosBuild(string pathToBuiltProject) { UnityEditor.iOS.Xcode.PBXProject project = new UnityEditor.iOS.Xcode.PBXProject(); string pbxPath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(pathToBuiltProject); project.ReadFromFile(pbxPath); #if UNITY_2019_3_OR_NEWER string targetId = project.GetUnityFrameworkTargetGuid(); #else string targetId = project.TargetGuidByName(UnityEditor.iOS.Xcode.PBXProject.GetUnityTargetName()); #endif project.AddFrameworkToProject(targetId, "AdSupport.framework", false); project.AddFrameworkToProject(targetId, "CoreTelephony.framework", false); project.AddFrameworkToProject(targetId, "StoreKit.framework", false); project.AddFrameworkToProject(targetId, "WebKit.framework", false); project.AddFileToBuild(targetId, project.AddFile("usr/lib/libsqlite3.dylib", "Frameworks/libsqlite3.dylib", UnityEditor.iOS.Xcode.PBXSourceTree.Sdk)); project.AddFileToBuild(targetId, project.AddFile("usr/lib/libz.1.1.3.dylib", "Frameworks/libz.1.1.3.dylib", UnityEditor.iOS.Xcode.PBXSourceTree.Sdk)); project.AddBuildProperty(targetId, "OTHER_LDFLAGS", "-ObjC"); project.WriteToFile(pbxPath); Debug.Log("Vungle iOS post processor completed."); }
public static void OnPostprocessBuild(BuildTarget buildTarget, string path) { UnityEngine.Debug.Log("OnPostprocessBuild "+buildTarget+" "+path); if (buildTarget == BuildTarget.iOS) { string projectPath = PBXProject.GetPBXProjectPath(path); PBXProject project = new PBXProject(); project.ReadFromFile(projectPath); UnityEngine.Debug.Log(PBXProject.GetUnityTargetName()); string target = project.TargetGuidByName(PBXProject.GetUnityTargetName()); UnityEngine.Debug.Log(target); // Add build settings for CocoaPods project.AddBuildProperty(target, "HEADER_SEARCH_PATHS", "$(inherited)"); project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(inherited)"); project.AddBuildProperty(target, "OTHER_CFLAGS", "$(inherited)"); project.AddBuildProperty(target, "OTHER_LDFLAGS", "$(inherited)"); // Disable Bitcode project.SetBuildProperty(target, "ENABLE_BITCODE", "NO"); // Copy Podfile into project string unityProjectRootPath = Path.GetFullPath("./").Normalize(); UnityEngine.Debug.Log(unityProjectRootPath); // Default src location is the project root FileUtil.ReplaceFile("Assets/DeltaDNAAds/Editor/iOS/Podfile", path + "/Podfile"); // Set Podfile platform version to match Unity #if UNITY_5_5_OR_NEWER var targetOSVersion = PlayerSettings.iOS.targetOSVersionString; string iosPlatform = targetOSVersion.ToString(); UnityEngine.Debug.Log(iosPlatform); #else var targetOSVersion = PlayerSettings.iOS.targetOSVersion; string iosPlatform = targetOSVersion.ToString().Substring(4).Replace('_', '.'); #endif var podfile = new List<string>(File.ReadAllLines(path + "/Podfile")); podfile = new List<string>(podfile.Select(e => e.StartsWith("platform") ? string.Format("platform :ios, '{0}'", iosPlatform) : e).AsEnumerable()); File.WriteAllLines(path + "/Podfile", podfile.ToArray()); // Update the XCode project on disk project.WriteToFile(projectPath); // Run pod update Process proc = new Process(); proc.StartInfo.FileName = "/usr/local/bin/pod"; proc.StartInfo.Arguments = "install --project-directory=\""+path+"\""; proc.StartInfo.UseShellExecute = false; proc.Start(); proc.WaitForExit(); } }
private static void fixPbxproject(string path) { #if UNITY_IOS UnityEditor.iOS.Xcode.PBXProject pbxProj = new UnityEditor.iOS.Xcode.PBXProject(); pbxProj.ReadFromFile(path); string targetGuid = pbxProj.TargetGuidByName("Unity-iPhone"); pbxProj.SetBuildProperty(targetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES"); pbxProj.WriteToFile(path); AddDynamicFrameworksForUnity5(path); #endif }
private static void DoAddLocalizationFolder(string projectPath) { string pbxProjectPath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(projectPath); UnityEditor.iOS.Xcode.PBXProject originalProj = new UnityEditor.iOS.Xcode.PBXProject(); originalProj.ReadFromFile(pbxProjectPath); string localizationFolderPath = $"{projectPath}/Localization"; if (false == Directory.Exists(localizationFolderPath)) { Directory.CreateDirectory(localizationFolderPath); } originalProj.AddFolderReference(localizationFolderPath, "Localization"); originalProj.WriteToFile(pbxProjectPath); }
public static void OnPostProcessBuild(BuildTarget buildTarget, string path) { #if UNITY_IPHONE if (buildTarget == BuildTarget.iOS) { Debug.Log("DisableBitCodePostProcessor - start"); string projectPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; UnityEditor.iOS.Xcode.PBXProject pbxProject = new UnityEditor.iOS.Xcode.PBXProject(); pbxProject.ReadFromFile(projectPath); string target = pbxProject.TargetGuidByName("Unity-iPhone"); pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO"); pbxProject.WriteToFile(projectPath); Debug.Log("DisableBitCodePostProcessor - done"); } #endif }
private static void removeCompatibilityLibraryFromProject(XCProject project) { string folderPath = Path.Combine(Application.dataPath, "Fyber/iOS/fyber-sdk-compat-lib"); if (Directory.Exists(folderPath)) { Debug.Log(folderPath + " exists. Deleting it"); Directory.Delete(folderPath, true); } string libPath = Path.Combine(project.projectRootPath, "Libraries/Fyber/iOS/fyber-sdk-compat-lib"); if (Directory.Exists(libPath)) { Debug.Log(libPath + " exists. Deleting it"); Directory.Delete(libPath, true); } #if UNITY_5 var compatGroup = "Libraries/Fyber/iOS/fyber-sdk-compat-lib"; string[] filesToRemove = { "FYBBannerSize.h", "FYBBannerView.h", "libFyberSDKCompat.a" }; UnityEditor.iOS.Xcode.PBXProject pbxProject = new UnityEditor.iOS.Xcode.PBXProject(); string pbxprojPath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(project.projectRootPath); pbxProject.ReadFromFile(pbxprojPath); foreach (string file in filesToRemove) { var fileToRemove = compatGroup + "/" + file; if (pbxProject.ContainsFileByProjectPath(fileToRemove)) { string guid = pbxProject.FindFileGuidByProjectPath(fileToRemove); pbxProject.RemoveFile(guid); } } pbxProject.WriteToFile(pbxprojPath); #endif // UNITY_5 }
public static void OnPostProcessBuild(BuildTarget platform, string projectPath) { if (platform != BuildTarget.iOS) { return; } string pbxFile = PBXProject.GetPBXProjectPath(projectPath); PBXProject pbxProject = new PBXProject(); pbxProject.ReadFromFile(pbxFile); string target = pbxProject.TargetGuidByName(PBXProject.GetUnityTargetName()); pbxProject.AddFrameworkToProject(target, "Security.framework", false); pbxProject.AddFrameworkToProject(target, "GLKit.framework", false); pbxProject.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC"); pbxProject.WriteToFile(pbxFile); }
public static void OnPostProcessBuild (BuildTarget buildTarget, string path) { #if UNITY_ANDROID #elif UNITY_IPHONE string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; PBXProject pbxProj = new PBXProject (); pbxProj.ReadFromFile (projPath); string target = pbxProj.TargetGuidByName (PBXProject.GetUnityTargetName ()); pbxProj.AddFrameworkToProject (target, "AssetsLibrary.framework", false); pbxProj.AddFrameworkToProject (target, "AudioToolbox.framework", false); pbxProj.AddFrameworkToProject (target, "AVFoundation.framework", false); pbxProj.AddFrameworkToProject (target, "CFNetwork.framework", false); pbxProj.AddFrameworkToProject (target, "CoreAudio.framework", false); pbxProj.AddFrameworkToProject (target, "CoreLocation.framework", false); pbxProj.AddFrameworkToProject (target, "CoreMedia.framework", false); pbxProj.AddFrameworkToProject (target, "CoreTelephony.framework", false); pbxProj.AddFrameworkToProject (target, "CoreVideo.framework", false); pbxProj.AddFrameworkToProject (target, "CoreGraphics.framework", false); pbxProj.AddFrameworkToProject (target, "ImageIO.framework", false); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libc++.dylib", "Frameworks/libc++.dylib", PBXSourceTree.Sdk)); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libc++abi.dylib", "Frameworks/libc++abi.dylib", PBXSourceTree.Sdk)); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libsqlite3.dylib", "Frameworks/libsqlite3.dylib", PBXSourceTree.Sdk)); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libstdc++.dylib", "Frameworks/libstdc++.dylib", PBXSourceTree.Sdk)); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libxml2.dylib", "Frameworks/libxml2.dylib", PBXSourceTree.Sdk)); pbxProj.AddFileToBuild (target, pbxProj.AddFile ("usr/lib/libz.dylib", "Frameworks/libz.dylib", PBXSourceTree.Sdk)); pbxProj.AddFrameworkToProject (target, "MapKit.framework", false); pbxProj.AddFrameworkToProject (target, "OpenGLES.framework", false); pbxProj.AddFrameworkToProject (target, "QuartzCore.framework", false); pbxProj.AddFrameworkToProject (target, "SystemConfiguration.framework", false); pbxProj.AddFrameworkToProject (target, "UIKit.framework", false); DirectoryInfo di = new DirectoryInfo (Application.dataPath); string rongCloudLibFloder = Path.Combine (di.Parent.FullName, "RongCloudLib"); CopyAndReplaceDirectory(Path.Combine (rongCloudLibFloder, "RongIMLib.framework"), Path.Combine(path, "Frameworks/RongIMLib.framework")); pbxProj.AddFileToBuild(target, pbxProj.AddFile("Frameworks/RongIMLib.framework", "Frameworks/RongIMLib.framework", PBXSourceTree.Source)); // pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (rongCloudLibFloder, "RongIMLib.framework"), "Frameworks/RongIMLib.framework", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/RongCloudBinding.m"), "Libraries/RongCloudBinding.m", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/RongCloudManager.m"), "Libraries/RongCloudManager.m", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/RongCloudManager.h"), "Libraries/RongCloudManager.h", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/GroupOperationMessage.h"), "Libraries/GroupOperationMessage.h", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/GroupOperationMessage.m"), "Libraries/GroupOperationMessage.m", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/GroupRequestMessage.h"), "Libraries/GroupRequestMessage.h", PBXSourceTree.Absolute)); pbxProj.AddFileToBuild (target, pbxProj.AddFile (Path.Combine (Application.dataPath, "Editor/RongCloud/iOS/GroupRequestMessage.m"), "Libraries/GroupRequestMessage.m", PBXSourceTree.Absolute)); pbxProj.SetBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(inherited)"); pbxProj.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(PROJECT_DIR)/Frameworks"); pbxProj.WriteToFile (projPath); PlistDocument plist = new PlistDocument (); string plistPath = Path.Combine (path, "Info.plist"); plist.ReadFromFile (plistPath); var deviceCapabilities = plist.root ["UIRequiredDeviceCapabilities"].AsArray (); deviceCapabilities.AddString ("front-facing-camera"); deviceCapabilities.AddString ("video-camera"); // plist.root.SetBoolean ("LSHasLocalizedDisplayName", true); plist.WriteToFile (plistPath); #endif }
public static void OnPostProcessBuildFirst(BuildTarget bt, string path) { if(bt == BuildTarget.WebGL){ moveResources("levels",false); }else{ moveResources("webLevels",false); } if(bt == BuildTarget.iOS || bt == BuildTarget.StandaloneOSXUniversal){ moveResources("achievementIcons",false); } AssetDatabase.Refresh(); switch(lastPlatform){ case platform.osx: if(PlayerSettings.useMacAppStoreValidation){ runShell("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_osx/fixAndSign.sh"); }else{ runShell("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_osx/fixSignAndOpen.sh"); } break; case platform.ios: //I know I should make the paths relative but you can't tell me what to do runShell("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_ios/build.sh"); //find project string projectPath = "/Volumes/Jesper Ext/unity/ZeGame/ZeGame_ios/xcode/Unity-iPhone.xcodeproj/project.pbxproj"; PBXProject project = new PBXProject(); project.ReadFromFile(projectPath); string targetGuid = project.TargetGuidByName("Unity-iPhone"); //add cloudkit framework (this is still easy) project.AddFrameworkToProject(targetGuid,"CloudKit.framework",false); //copy the entitlements file, you should generate this once //using xcode, then put it somewhere on your disk so //you can copy it to this location later File.Copy("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_ios/ZeGame.entitlements","/Volumes/Jesper Ext/unity/ZeGame/ZeGame_ios/xcode/Unity-iPhone/ZeGame.entitlements"); //now this is where it gets messy, because the PBXProject //class doesn't support enabling iCloud so you'll //have to change the string manually //I suggest you build your xcode project once (without //playing it automatically, so you'll have to remove // BuildOptions.AutoRunPlayer; from the buildoptions //then duplicate your xcode project folder and enable //iCloud in one of them. You can then use a site like //https://www.diffnow.com/ to find the difference //between the two projects. //not all differences have to be included but these are //the ones I found that are necessary. string projectString = project.WriteToString(); //add entitlements file projectString = projectString.Replace("/* Begin PBXFileReference section */", "/* Begin PBXFileReference section */\n\t\t244C317F1B8BE5CF00F39B20 /* ZeGame.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = ZeGame.entitlements; path = \"Unity-iPhone/ZeGame.entitlements\"; sourceTree = \"<group>\"; };"); //add entitlements file (again) projectString = projectString.Replace("/* CustomTemplate */ = {\n isa = PBXGroup;\n children = (", "/* CustomTemplate */ = {\n isa = PBXGroup;\n children = (\n 244C317F1B8BE5CF00F39B20 /* ZeGame.entitlements */,"); //add some kind of entitlements command projectString = projectString.Replace("CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;", "CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = \"Unity-iPhone/ZeGame.entitlements\";"); //add development team you'll have to replace **** //with your own development string, which you can find //in your project.pbxproj file after enabling icloud projectString = projectString.Replace("TargetAttributes = {", "TargetAttributes = {\n 1D6058900D05DD3D006BFB54 = {\n DevelopmentTeam = ******;\n };"); //save the file File.WriteAllText(projectPath, projectString); break; case platform.windows: lastPlatform = platform.windows64; buildLast(); break; case platform.windows64: lastPlatform = platform.windows; File.Delete("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_windows/64/player_win_x64_s.pdb"); File.Delete("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_windows/64/player_win_x64.pdb"); File.Delete("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_windows/32/player_win_x86_s.pdb"); File.Delete("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_windows/32/player_win_x86.pdb"); break; case platform.linux: runShell("/Volumes/Jesper Ext/unity/ZeGame/ZeGame_linux/build.sh"); break; } }
public static void OnPostProcessBuild(BuildTarget target, string path) { #if UNITY_IPHONE || UNITY_IOS #if UNITY_5 if (target == BuildTarget.iOS) #else if (target == BuildTarget.iPhone) #endif // UNITY_5 { string folderPath = Path.Combine(Application.dataPath, "Fyber/iOS/fyber-sdk-compat-lib"); if (Directory.Exists(folderPath)) { Directory.Delete(folderPath, true); } XCProject project = new XCProject(path); string libPath = Path.Combine(project.projectRootPath, "Libraries/Fyber/iOS/fyber-sdk-compat-lib"); if (Directory.Exists(libPath)) { Directory.Delete(libPath, true); } // Find and run through all projmods files to patch the project string projModPath = System.IO.Path.Combine(Application.dataPath, "Fyber/iOS"); string[] files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories); foreach (var file in files) { project.ApplyMod(Application.dataPath, file); if (file.Contains("NativeX")) { string unityVersionPlist = "<plist><key>name</key><string>Nativex</string><key>settings</key><dict><key>FYBNativeXUnityBuildFlag</key><true /></dict></plist>"; PlistUpdater.UpdatePlist(project.projectRootPath, unityVersionPlist); } } project.Save(); #if UNITY_5 var compatGroup = "Libraries/Fyber/iOS/fyber-sdk-compat-lib"; string[] filesToRemove = { "FYBBannerSize.h", "FYBBannerView.h", "libFyberSDKCompat.a" }; UnityEditor.iOS.Xcode.PBXProject pbxProject = new UnityEditor.iOS.Xcode.PBXProject(); string pbxprojPath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath(path); pbxProject.ReadFromFile(pbxprojPath); foreach (string file in filesToRemove) { var fileToRemove = compatGroup + "/" + file; if (pbxProject.ContainsFileByProjectPath(fileToRemove)) { string guid = pbxProject.FindFileGuidByProjectPath(fileToRemove); pbxProject.RemoveFile(guid); } } pbxProject.WriteToFile(pbxprojPath); #endif // UNITY_5 } #endif //UNITY_IPHONE || UNITY_IOS }
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); }