I am trying to incorporate localnotifications that fire after a certain time interval, however, I can't seem to get the notification to display at any point when testing with the simulator.
I simply want to display the local notification 10 seconds after creation, however, when running the app in the simulator nothing ever displays regardless of whether the app is in the foreground or background.
Am I missing something? Could this have something do to with timezone?
//Notification setup
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
localNotification.alertBody = @"Testing";
localNotification.alertAction = @"Show me the item";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
//This is the didReceiveLocalNotification in my app delegate
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder" message:notification.alertBody delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}