Production Push Notifications using Firebase with APNs Auth Key

旧街凉风 提交于 2019-12-05 12:12:05

The fix for me was to stop using MessagingAPNSTokenType.sandbox or .prod, and just use:

Messaging.messaging().setAPNSToken(deviceToken, type: .unknown)

In a previous app, I used:

if Config.isDebug {
    tokenType = MessagingAPNSTokenType.sandbox
} else {
    tokenType = MessagingAPNSTokenType.prod
}
Messaging.messaging().setAPNSToken(deviceToken, type: tokenType)

and set up Config to depend on the build scheme in Xcode. Now it appears not to work in prod. On Firebase, I am now using an APNS Key, as opposed to the older style Prod and Dev certificates. That may have made a difference. I see that the Firebase docs also now say:

If the token type is set to UNKNOWN Firebase Messaging will implicitly try to figure out what the actual token type is from the provisioning profile. Unless you really need to specify the type, you should use the APNSToken property instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!