推送通知不适用于具有 "completely unknown token" 日志的特定设备

Push-notifications doesn't work for a specific device with "completely unknown token" log

非静默推送通知不适用于 iOS 10.0 的非开发人员设备。 证书或配置文件没有问题,APNS 也没有响应 "Bad error" 任何其他错误,因此令牌似乎有效(我尝试从服务器和名为 Pusher 的本地工具发送通知,结果是一样的)。

当我将设备插入 Mac 并查看控制台日志时,我可以看到以下几行:

default 15:43:26.138766 +0300   apsd    2017-07-12 15:43:26 +0300 apsd[86]: isAppSpecificTokenValid? <cf0d4bad 846685a1 0b0e4e34 0e1ad03e 74c00df2 295a23e3 7586f94c 78c46284> found cached token NO
default 15:43:26.139477 +0300   apsd    2017-07-12 15:43:26 +0300 apsd[86]: Received incoming push notification for topic: <my.app.id> but for a completely unknown token <cf0d4bad 846685a1 0b0e4e34 0e1ad03e 74c00df2 295a23e3 7586f94c 78c46284>
default 15:43:26.140523 +0300   apsd    2017-07-12 15:43:26 +0300 apsd[86]: <APSCourier: 0x1004109c0>: Responding with REMOVED status for message received with topic: '<my.app.id>' to device token (instead of per-app token)

我想不出重现此错误的步骤,但这可能与在 TestFlight 版本上安装 AppStore 版本有关。

but it may be related to the installing the AppStore version over the TestFlight version.

这会成为一个问题,听起来您并没有在每次应用程序启动时都执行 registerForRemoteNotifications。您应该每次都执行此调用(并可能在您的后端更新它),因为它有可能会更改,并且用户也有可能更改了您的应用程序的权限,而不是 运行.