Alternative to getting payload out of notification when user doesn't directly tap the notification?

42 views Asked by At

I have a method in my app that executes via an observer and sender, and it works when the user taps the local/push notification as the code processes in the App Delegate under "didReceiveRemoteNotification." However, when the user ignores the notification, and taps the app instead, the method won't get executed. Is there a way I can get around this? The reason I am using the notifications is because I am using cloudkit and the notification fires under a subscription which looks at when a record is created.

ex. sender

[[NSNotificationCenter defaultCenter]
             postNotificationName:@"observeChange1"
             object:self];

ex observer

 [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(observeChange1:)
                                             name:@"observeChange1"
                                           object:nil]; 
1

There are 1 answers

1
Jerry On

If you use the new notifications from iOS 10, I think you might be able to call getDeliveredNotifications, but I don't know if that will include the payload or not.