[英]didReceiveRemoteNotification fetchCompletionHandler is not getting called in background for silent push
So I have added didReceiveRemoteNotification
delegate to handle silent push notification 所以我添加了
didReceiveRemoteNotification
委托来处理静默推送通知
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
This method should be invoked in the background to update the content before notifying the user, so that the user can open the application and be presented with new content immediately. 应该在通知用户之前在后台调用此方法以更新内容,以便用户可以打开应用程序并立即看到新内容。
But this method is never getting called in background. 但是这种方法永远不会在后台调用。 I have tried to debug the issue but no success.
我试图调试问题,但没有成功。 Surprisingly this method is getting called properly if my app is in foreground and I am easily able to check
content-available
to update the UI. 令人惊讶的是,如果我的应用程序位于前台并且可以轻松地检查
content-available
以更新UI,则可以正确调用此方法。
Can anyone please help me with this issue that why didReceiveRemoteNotification:fetchCompletionHandler
is not getting called in background ? 谁能帮我解决这个问题,为什么
didReceiveRemoteNotification:fetchCompletionHandler
没有在后台被调用?
Issue was related to incorrect payload. 问题与有效载荷不正确有关。
I was getting content-available
outside aps instead it should be part of aps. 我在aps之外获得了
content-available
而应该是aps的一部分。
Incorrect payload: 有效载荷不正确:
{
"_" = "asd-dfsd-werdsf";
aps = {
};
"content-available" = 1;
}
Correct payload: 正确的有效载荷:
{
"_" = "asd-dfsd-werdsf";
aps = {
"content-available" = 1;
};
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.