0

I guess its very simple, but my search results just won't get me this scenario .

When user get a notification , but he is :

  1. not sliding the on lock screen's notification message, but open the app from the icon
  2. he just open the app after a while not from the notification message

How in these cases , you would know when app was opened , that there where notifications waiting for you in the stack ?

                UILocalNotification * notification = [[UILocalNotification alloc] init];
                notification.fireDate = newdate;
                notification.repeatInterval = NSCalendarUnitDay;
                notification.alertTitle=@"reminder";
                notification.alertBody = message;
                notification.soundName=@"shake.mp3";
                 notification.userInfo=med;
Curnelious
  • 1
  • 16
  • 76
  • 150

1 Answers1

0

As the app is the one to schedule them, you could keep track of all notifications scheduled and every time the app is opened without triggering application:didReceiveLocalNotification: you could see if any should have fired.

However, it's really hard to tell when the app is opened whether some event will or will not happen. You could use a timer which you invalidate in application:didReceiveLocalNotification:, but that's really hacky.

So the correct answer is that you shouldn't ever rely on a notification being "opened" by the user. Instead, you should assume that if the user ignored the notification and opened your app some other way, that you should not do anything based on outstanding or expired notifications.

Avi
  • 7,469
  • 2
  • 21
  • 22