Hi. I'm using Unity 4.3 and having a bit of a problem with getting local notifications on iOS to display. I'm using this code to schedule one:
var notification = new LocalNotification();
notification.fireDate = System.DateTime.Now.AddSeconds(10);
notification.alertBody = "Hello.";
NotificationServices.ScheduleLocalNotification(notification);
The notification never appears though. What exactly do I have to do besides using that code to get it to work? The documentation isn't mentioning anything, but maybe I need to change something in the app settings through XCode? Or maybe I need to add some more code elsewhere? Or maybe I need to add certain frameworks to the app?
At the moment, the notification is just completely absent no matter the lock state of the phone and no matter the state of the app (paused, closed). Unfortunately it's extremely hard to find any information about local notifications on the net besides official Unity and XCode docs as absolute majority of questions and threads are dedicated to push notifications which aren't exactly what I need.
P.S.: Besides, shouldn't I be seeing my game in the Notification Center section of iOS Settings app if notifications were working correctly? That's not happening either.
P.P.S.: I've heard there were some huge problems with how System.DateTime works on iOS in Unity 4.3 - could it be the reason for the issue (i.e. notifications are created correctly, but the scheduled time they get is completely wrong)? I'm building my XCode projects from PC, if that matters.
↧