-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
NSLog(@"PUSH NOTIFICATION %@",userInfo);
if([userInfo[@"aps"][@"content-available"] intValue] == 1){
NSLog(@"SILENT PUSH NOTIFICATION");
//Here I'm inserting a flag value to my DB.
completionHandler(UIBackgroundFetchResultNewData);
}
else{
NSLog(@" GENERAL PUSH NOTIFICATION ");
completionHandler(UIBackgroundFetchResultNoData);
}
}
My silent notification payload is {
aps = {
"content-available" = 1;
sound = "";
};
}
-(void)application:(UIApplication *)application