Created
July 4, 2019 13:34
-
-
Save NicholasSheehan/1e1f27648a661656d65759a354c76608 to your computer and use it in GitHub Desktop.
UIApplicationExitsOnSuspend Info.plist Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_IOS | |
using System.IO; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.iOS.Xcode; | |
using UnityEngine; | |
namespace NicholasSheehan | |
{ | |
class UIApplicationExitsOnSuspendFix | |
{ | |
[PostProcessBuild(10000)] | |
public static void RemoveUIApplicationExitsOnSuspendKey(BuildTarget target, string pathToBuiltProject) | |
{ | |
if (target != BuildTarget.iOS) return; | |
var plistPath = pathToBuiltProject + "/Info.plist"; | |
var plist = new PlistDocument(); | |
plist.ReadFromString(File.ReadAllText(plistPath)); | |
// Get root | |
PlistElementDict rootDict = plist.root; | |
//remove depreciated keys | |
rootDict.values.Remove("UIApplicationExitsOnSuspend"); | |
//saves the plist file | |
File.WriteAllText(plistPath, plist.WriteToString()); | |
Debug.Log("Saving Edited Plist.info"); | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment