Skip to content

Instantly share code, notes, and snippets.

@dialupnoises
Created September 29, 2018 03:14
Show Gist options
  • Save dialupnoises/d1e36515b12191caa4390a94d948af1b to your computer and use it in GitHub Desktop.
Save dialupnoises/d1e36515b12191caa4390a94d948af1b to your computer and use it in GitHub Desktop.
#if UNITY_IOS
using UnityEditor.Callbacks;
using UnityEditor;
using UnityEditor.iOS.Xcode;
using System.IO;
public class PostProcessXCodeCalendarFix
{
[PostProcessBuild]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
{
if(buildTarget == BuildTarget.iOS)
{
// Get plist
string plistPath = pathToBuiltProject + "/Info.plist";
var plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
// Get root
var rootDict = plist.root;
rootDict.SetString("NSCalendarsUsageDescription", "Calendar access used by third party advertising partners.");
// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
}
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment