[펌] PostProcessing iOS Activate Background Mode for Push Notifications
Unity3D/Script / 2019. 6. 4. 15:33
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.
[출처] https://answers.unity.com/questions/1066927/postprocessing-ios-activate-background-mode-for-pu.html
반응형
'Unity3D > Script' 카테고리의 다른 글
[펌] Unity 런타임 중 AndroidManifest.xml에서 meta-data 정보 읽어오기. (0) | 2019.12.04 |
---|---|
[펌] Is there an isPlaying() type function for Animator (0) | 2019.11.13 |
XCode-Capabilities-Push Notifications를 기본 ON 하는 방법 (0) | 2019.06.04 |
[펌] Unity5のPostProcessBuildでXcode Capabilityの設定する方法 (0) | 2019.06.03 |
[펌] Enable Push Notification in XCode project by default? (0) | 2019.06.03 |