How can I set something within PlayerSettings to make UNITY_USES_REMOTE_NOTIFICATIONS=1
instead of manually editing the preprocessor.h file?
Setting UNITY_USES_REMOTE_NOTIFICATIONS=1
in the ‘Scripting Define Symbols’ text field doesn’t work.
How can I set something within PlayerSettings to make UNITY_USES_REMOTE_NOTIFICATIONS=1
instead of manually editing the preprocessor.h file?
Setting UNITY_USES_REMOTE_NOTIFICATIONS=1
in the ‘Scripting Define Symbols’ text field doesn’t work.
It’s a little bit hacky but a post-build processor should solve the issue.
using System.Collections;
using System.IO;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
public static class PostBuildProcessor
{
#if UNITY_IOS
[PostProcessBuild(999)]
public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
{
string preprocessorPath = path + "/Classes/Preprocessor.h";
string text = File.ReadAllText(preprocessorPath);
text = text.Replace("UNITY_USES_REMOTE_NOTIFICATIONS 0", "UNITY_USES_REMOTE_NOTIFICATIONS 1");
File.WriteAllText(preprocessorPath, text);
}
#endif
}
thanks. i used this too. this wasn’t broken before. wonder if it’s a bug that got introduced.