You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
using UnityEditor; |
|
using UnityEditor.Callbacks; |
|
#if UNITY_IOS |
|
using System.IO; |
|
using UnityEditor.iOS.Xcode; |
|
#endif |
|
|
|
public class BuildProcessor |
|
{ |
|
[PostProcessBuild(1)] |
|
public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject) |
|
{ |
|
#if UNITY_IOS |
|
// Get plist |
|
string plistPath = pathToBuiltProject + "/Info.plist"; |
|
PlistDocument plist = new PlistDocument(); |
|
plist.ReadFromString(File.ReadAllText(plistPath)); |
|
|
|
// Get root |
|
PlistElementDict rootDict = plist.root; |
|
|
|
// Set encryption usage boolean |
|
string encryptKey = "ITSAppUsesNonExemptEncryption"; |
|
rootDict.SetBoolean(encryptKey, false); |
|
|
|
// remove exit on suspend if it exists. |
|
string exitsOnSuspendKey = "UIApplicationExitsOnSuspend"; |
|
if(rootDict.values.ContainsKey(exitsOnSuspendKey)) |
|
{ |
|
rootDict.values.Remove(exitsOnSuspendKey); |
|
} |
|
|
|
// Write to file |
|
File.WriteAllText(plistPath, plist.WriteToString()); |
|
#endif |
|
} |
|
} |