Is there a way in AppDelegate to get a queue of all the notification data? (Once the user opens the app).
For UILocalNotification
, you can get received notifications by calling following function in your AppDelegate
:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateInactive) {
// Application was in the background when notification was delivered.
}
}
If you want to find the list of local Notifications, that app has already set, check this solution.
You can check for launchOptions Dictionary, for received Notification, when App resumes on tapping a notification,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. NSLog(@"Launch Options:%@",launchOptions); return YES; }
Try this in your app delegate
:
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
As per apple documentation:
When a remote notification arrives, the system calls the application:didReceiveRemoteNotification:fetchCompletionHandler:
method. Notifications usually signal the availability of new information. In your app delegate method, you might begin downloading new data from a server so that you can update your app’s data structures. You might also use the notification to update your user interface.
You have to enable remote notification background mode
, only then you will get a callback to the above mentioned method.