didReceiveRemoteNotification:fetchCompletionHandler没有在后台调用content-available标志(连接到XCode时被调用)

时间:2016-03-30 00:41:27

标签: ios objective-c xcode debugging apple-push-notifications

我在推送通知方面遇到了一个非常奇怪的问题。

当应用程序连接到Xcode(调试版本)时,didReceiveRemoteNotification:fetchCompletionHandler就像它应该的那样。

  • didReceiveRemoteNotification:fetchCompletionHandler是 当app在前台时收到推送时触发
  • didReceiveRemoteNotification:fetchCompletionHandler是 当app在后台时收到推送时触发
  • didReceiveRemoteNotification:fetchCompletionHandler是 收到推送后触发,通过通知中心(推送)打开应用程序

但是,当我在手机上构建我的应用程序时,不使用xcode:

  • didReceiveRemoteNotification:fetchCompletionHandler
    当app在前台时收到推送时触发
  • didReceiveRemoteNotification:fetchCompletionHandler 当app在后台时收到推送时触发
  • didReceiveRemoteNotification:fetchCompletionHandler
    收到推送后触发,通过通知中心(推送)打开应用程序

使事情进一步复杂化:

出于某种不道德的原因,这只是停止了工作。然后,只是随机地,它似乎固定了自己(这是在24小时的范围内)。然而,大约5分钟前,它再次停止工作。似乎我的一些用户正在经历同样的事情,而其他用户也很好。

我虽然生产推送证书可能有问题但是为什么我接受推送?我完全迷失在这里。

PS:消息有效负载模板:

{
    aps =     {
        alert = "<message>";
        badge = 1;
        "content-available" = 1;
        sound = "layerbell.caf";
    };
    layer =     {
        "<convoId>";
        "<messageId>";
    };
}

请注意这与终止状态无关。我知道如果应用程序被终止,将不会调用didReceiveRemoteNotification:fetchCompletionHandler。这不是问题所在。

0 个答案:

没有答案