I want to save some push notification data in application.But I can not save data if the user terminate the app by swiping up the app on the multitask viewer (Suspend or not runing state).I used application:didReceiveRemoteNotification:fetchCompletionHandler: to handle it.But still I could not save push notification data
I have set App settings like this
And Payload,
{
"aps" : {
"alert" = "Notification with custom payload",
},
"content-available" = 1
}
And application:didReceiveRemoteNotification:fetchCompletionHandler: looks like this
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if(application.applicationState == UIApplicationStateInactive) {
NSLog(@"Inactive");
//Show the view with the content of the push
completionHandler(UIBackgroundFetchResultNewData);
} else if (application.applicationState == UIApplicationStateBackground) {
NSLog(@"Background");
NSString *info = [[userInfo valueForKey:@"aps"]valueForKey:@"alert"];
completionHandler(UIBackgroundFetchResultNewData);
} else {
NSLog(@"Active");
//Show an in-app banner
completionHandler(UIBackgroundFetchResultNewData);
}
}