Created
December 23, 2017 11:25
-
-
Save yosun/af058a39c400ac5fb47ed2157499381a to your computer and use it in GitHub Desktop.
PostProcessor to include photo lib permissions
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
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.iOS.Xcode; | |
using System; | |
using System.IO; | |
//============================================================================= | |
// This PostProcessor does all annoying Xcode steps automatically for us | |
//============================================================================= | |
public class PostProcessor | |
{ | |
[PostProcessBuild] | |
public static void OnPostProcessBuild(BuildTarget target, string path) | |
{ | |
if(target != BuildTarget.iOS) { return; } | |
string plistPath = Path.Combine(path, "Info.plist"); | |
PlistDocument plist = new PlistDocument(); | |
plist.ReadFromString(File.ReadAllText(plistPath)); | |
PlistElementDict rootDict = plist.root; | |
rootDict.SetString("NSPhotoLibraryUsageDescription", "Can we save your polygon photos and videos to your photo album?"); | |
rootDict.SetString("NSPhotoLibraryAddUsageDescription", "Can we save your polygon photos and videos to your photo album?"); | |
File.WriteAllText(plistPath, plist.WriteToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment