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

Jon*_*mos 6 debugging xcode objective-c apple-push-notifications ios

推送通知我有一个非常奇怪的问题.

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

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

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

  • didReceiveRemoteNotification:fetchCompletionHandler
    当应用程序在前台收到推送时触发
  • didReceiveRemoteNotification:fetchCompletionHandler不是 收到推送时,当应用程序在后台触发
  • didReceiveRemoteNotification:fetchCompletionHandler
    当接收到推和应用程式经由通知中心打开触发(从推)

使事情进一步复杂化:

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

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

PS:消息有效负载模板:

{
    aps =     {
        alert = "<message>";
        badge = 1;
        "content-available" = 1;
        sound = "layerbell.caf";
    };
    layer =     {
        "<convoId>";
        "<messageId>";
    };
}
Run Code Online (Sandbox Code Playgroud)

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