-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary
*)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"Push info= %@",userInfo);
if([userInfo[@"aps"][@"content-available"] intValue] == 1)
{
NSLog(@"silent push notification received");
NSString *strQuery = [NSString stringWithFormat:@"UPDATE staff_list SET is_update =
'YES'"];
[[DatabaseManager sharedInstance] updateDatabaseForQuery:strQuery];
completionHandler(UIBackgroundFetchResultNewData);
return;
}
else
{
completionHandler(UIBackgroundFetchResultNoData);
return;
}
}
My payload for silent push notification is {
aps = {
"content-available" = 1;
sound = "";
};
}
也无法进行远程通知的后台模式。
当应用程序在前台运行时,这将是完美的,但是当我按下主页按钮时,应用程序在后台运行,之后在接收到新的静音推送通知时没有执行任何方法。
请帮助我,自从过去3天以来我一直坚持这一点。
提前致谢。