46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
|
#if UNITY_IOS
|
||
|
|
||
|
using UnityEditor;
|
||
|
using UnityEditor.Callbacks;
|
||
|
using UnityEditor.iOS.Xcode;
|
||
|
|
||
|
public static class CustomIOSPostprocess
|
||
|
{
|
||
|
[PostProcessBuild(999)]
|
||
|
public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
|
||
|
{
|
||
|
|
||
|
if(buildTarget == BuildTarget.iOS)
|
||
|
{
|
||
|
string projectPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
|
||
|
|
||
|
PBXProject pbxProject = new PBXProject();
|
||
|
pbxProject.ReadFromFile(projectPath);
|
||
|
string target = pbxProject.GetUnityMainTargetGuid();
|
||
|
|
||
|
DisableBitcode(pbxProject, target);
|
||
|
|
||
|
InsertPushNotificationSound(path, pbxProject, target);
|
||
|
|
||
|
pbxProject.WriteToFile(projectPath);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//AIHelp doesn't support bitcode :(
|
||
|
static void DisableBitcode(PBXProject pbxProject, string target)
|
||
|
{
|
||
|
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
||
|
}
|
||
|
|
||
|
static void InsertPushNotificationSound(string path, PBXProject pbxProject, string target)
|
||
|
{
|
||
|
//unity/Assets/sound/sfx/ui/push_notification file is actually a .caf sound file.
|
||
|
//It's extension is left out so the FCM's "sound" field looks the same for both Android and iOS
|
||
|
|
||
|
// EditorDevUtils.IOSAddLocalFile(path, pbxProject, target, "Assets/sound/sfx/ui", "push_notification");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|