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

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

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

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

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

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

使事情进一步复杂化:

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

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

PS:消息有效负载模板:

 { aps = { alert = ""; badge = 1; "content-available" = 1; sound = "layerbell.caf"; }; layer = { ""; ""; }; } 

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