using System.IO; using Prime31.Xcode; using UnityEditor; using UnityEditor.Callbacks; using UnityEngine; public class ChangeIOSBuildNumber { [PostProcessBuild(999)] public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) { if (buildTarget == BuildTarget.iOS) { Debug.Log("Write NSAppTransportSecurity settings to Info.plist ...."); // Get plist string plistPath = pathToBuiltProject + "/Info.plist"; PlistDocument plist = new PlistDocument(); plist.ReadFromString(File.ReadAllText(plistPath)); // Get root PlistElementDict rootDict = plist.root; var nsApp = rootDict.CreateDict("NSAppTransportSecurity"); var nsEx = nsApp.CreateDict("NSExceptionDomains"); var facebook = nsEx.CreateDict("facebook.com"); facebook.SetBoolean("NSIncludesSubdomains",true); facebook.SetBoolean("NSExceptionRequiresForwardSecrecy", false); var fbcdn = nsEx.CreateDict("fbcdn.net"); fbcdn.SetBoolean("NSIncludesSubdomains", true); fbcdn.SetBoolean("NSExceptionRequiresForwardSecrecy", false); var akamaihd = nsEx.CreateDict("akamaihd.net"); akamaihd.SetBoolean("NSIncludesSubdomains", true); akamaihd.SetBoolean("NSExceptionRequiresForwardSecrecy", false); var gamatic = nsEx.CreateDict("gamatic.com"); gamatic.SetBoolean("NSIncludesSubdomains", true); gamatic.SetBoolean("NSExceptionRequiresForwardSecrecy", false); var flurry = nsEx.CreateDict("flurry.com"); flurry.SetBoolean("NSIncludesSubdomains", true); flurry.SetBoolean("NSExceptionRequiresForwardSecrecy", false); //Save File.WriteAllText(plistPath, plist.WriteToString()); Debug.Log("Write NSAppTransportSecurity settings to Info.plist .... done!"); } } }