• Ciprian Bojin

Warning: The Info.plist contains a key 'UIApplicationExitsOnSuspend'


Did you get the following warning while uploading your Unity build to iOS?

ITMS-90339: Deprecated Info.plist Key - The Info.plist contains a key 'UIApplicationExitsOnSuspend' in bundle YourAppName[YourAppName.app] that will soon be unsupported. Remove the key, rebuild your app and resubmit.

Deprecated Info.plist Key - The Info.plist contains a key 'UIApplicationExitsOnSuspend'

Here's How To Fix It Manually

Open the Info.plist file and remove the Property List Key named 'Application does not run in background'. After you do this, you can rebuild your app and resubmit.

Unfortunately, every time you build your Unity project for iOS you need to remove it again. So how can you avoid this?


How to remove the Info.plist key automatically from Unity

The following script will make your life easier by automatically removing the key:


using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEditor;

using UnityEditor.Callbacks;

using UnityEditor.iOS.Xcode;


public class iOSPostProcessBuild : MonoBehaviour

{

[PostProcessBuild]

public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)

{

const string UIApplicationExitsOnSuspend = "UIApplicationExitsOnSuspend";

Debug.Log("Build Target: " + buildTarget);

Debug.Log("Path: " + pathToBuiltProject);

if (buildTarget == BuildTarget.iOS)

{

string plistPath = pathToBuiltProject + "/Info.plist";

PlistDocument plist = new PlistDocument();

plist.ReadFromFile(plistPath);


PlistElementDict root = plist.root;

var rootDic = root.values;

rootDic.Remove(UIApplicationExitsOnSuspend);


plist.WriteToFile(plistPath);

}

}

}


In order to use the script, you must add it in the Unity Scripts/Editor folder.

Now, when you build your Unity project, the key 'UIApplicationExitsOnSuspend' from Info.plist will automatically be removed and you will not have to worry about it again. Happy coding!

  • White Instagram Icon

©2020 by BulkyBrains