我找不到关于发送预定本地通知的适当教程。
我想出了这个,但下面的代码不起作用
void Start()
{
LocalNotification notif = new LocalNotification();
notif.fireDate = System.DateTime.Now.AddSeconds(5f);
notif.alertBody = "Hey";
NotificationServices.ScheduleLocalNotification(notif);
}请帮我处理这个
发布于 2015-07-29 09:33:18
就像这样:
void ScheduleNotificationForiOSWithMessage (string text, System.DateTime fireDate)
{
if (Application.platform == RuntimePlatform.IPhonePlayer) {
LocalNotification notification = new LocalNotification ();
notification.fireDate = fireDate;
notification.alertAction = "Alert";
notification.alertBody = text;
notification.hasAction = false;
NotificationServices.ScheduleLocalNotification (notification);
#if UNITY_IOS
NotificationServices.RegisterForLocalNotificationTypes (LocalNotificationType.Alert | LocalNotificationType.Badge);
#endif
}
}发布于 2015-07-29 09:12:02
你得先打电话给"NotificationServices.RegisterForNotifications“。见=> 统一文献
https://stackoverflow.com/questions/31695402
复制相似问题