iOS Local Notifications Testing

In testing my local notifications, for some reason setting the date and time on my iOS device does not trigger my local notification to appear. My notification's fire date is set to be several days in the future. If I do wait a few days then I will see my local notification.

Why am I not seeing my local notification by setting the date and time on my device?

Below is a sample:

            playNotification.FireDate = DateTime.Now.AddHours(71.67f);
            playNotification.AlertAction = "Alert text";
            playNotification.AlertBody = "Alert body";
            playNotification.SoundName = UILocalNotification.DefaultSoundName;
            playNotification.ApplicationIconBadgeNumber = badgeCount;

I should mention that I changed 'AddHours' to 'AddSeconds' and tested this by waiting the specified number of seconds, and the notifications fired as expected. But somehow changing the date and time on my device does not.


You need to set the timeZone of the notifications. By default, the timeZone is set according to your location so it does not affect if you manually change your date and time. To achieve this, you need to set the timeZone to systemTimeZone().

Like this:

    notification.timeZone = NSTimeZone.systemTimeZone()

I know this is in swift, but I know very little objective-c. Hope this helps. :)

Need Your Help

Import project from github

android eclipse github

I found this animated circle bar and I want to add it to my project.

UITableView with UISearchController go under navbar when enter in a result view and come back

ios objective-c uitableview uinavigationbar uisearchcontroller

I have a UITableView with a UISearchController search bar in the UINavigationBar, all works perfectly, but when I push a result of the searched results of the UISearchController, and I come back the