PostProcessing iOS Activate Background Mode for Push Notifications

I have a lot of postprocessing in my apps, but there is something I haven’t been able to automate.

On xCode, under Capabilities>Background Modes
There are a couple of checkboxes. Including one to enable push notifications.

Has anyone been able to make a postprocessor script that enables those checkboxes?

hello,

From that post : http://forum.unity3d.com/threads/how-can-you-add-items-to-the-xcode-project-targets-info-plist-using-the-xcodeapi.330574/ by modifying a bit the script i got that :

[PostProcessBuild]
	public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) {
		
		if (buildTarget == BuildTarget.iOS) {
			
			// Get plist
			string plistPath = pathToBuiltProject + "/Info.plist";
			PlistDocument plist = new PlistDocument();
			plist.ReadFromString(File.ReadAllText(plistPath));
			
			// Get root
			PlistElementDict rootDict = plist.root;
			
			// Change value of CFBundleVersion in Xcode plist
			var buildKey = "UIBackgroundModes";
			rootDict.CreateArray (buildKey).AddString ("remote-notification");
			
			// Write to file
			File.WriteAllText(plistPath, plist.WriteToString());
		}
	}

i just did it, it seems to work, need further test though.

Edit : Note that the script should be in Assets/Editor folder.
Edit 2 : i created i string it should be a array, i changed the code.