Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicholasSheehan/1e1f27648a661656d65759a354c76608 to your computer and use it in GitHub Desktop.
Save NicholasSheehan/1e1f27648a661656d65759a354c76608 to your computer and use it in GitHub Desktop.
UIApplicationExitsOnSuspend Info.plist Fix
#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