应用程序处于前台时Unity iOS生成本地通知
我目前正在Unity(用于iOS)中设计一个应用程序,其中在触发游戏内事件时会创建一个本地通知。目前,本地通知只能在应用程序在后台运行时显示,而不能在应用程序在前台运行时显示 当应用程序位于前台时,我如何允许通知显示 我更喜欢Unity本身而不是XCode中的解决方案,因为我在这个平台上工作更舒服 作为参考,本地通知设置在以下代码中:应用程序处于前台时Unity iOS生成本地通知,ios,unity3d,notifications,uilocalnotification,Ios,Unity3d,Notifications,Uilocalnotification,我目前正在Unity(用于iOS)中设计一个应用程序,其中在触发游戏内事件时会创建一个本地通知。目前,本地通知只能在应用程序在后台运行时显示,而不能在应用程序在前台运行时显示 当应用程序位于前台时,我如何允许通知显示 我更喜欢Unity本身而不是XCode中的解决方案,因为我在这个平台上工作更舒服 作为参考,本地通知设置在以下代码中: public void ScheduleNotification() { if (UnityEngine.iOS.NotificationService
public void ScheduleNotification()
{
if (UnityEngine.iOS.NotificationServices.localNotificationCount == 0) {
UnityEngine.iOS.LocalNotification notif = new UnityEngine.iOS.LocalNotification();
notif.fireDate = System.DateTime.Now.AddSeconds(5);
notif.alertBody = "Testing, testing, 123!";
UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(notif);
}
}