[英]Cannot get FCM Notification in some device in iOS
In my app I am using FCM push notification using swift3 . 在我的应用程序中,我正在使用swift3的 FCM推送通知 。 When ever app is install in device, some device get the notification and some are not get notified when push came.
在设备中安装过任何应用程序后,某些设备会收到通知,而某些设备不会在推送时收到通知。 When we update a new version without remove the app then cannot get the notification but if remove the app and reinstall it then we get the notifications.
当我们在不删除应用程序的情况下更新新版本时,无法获取通知,但是如果删除应用程序并重新安装,则我们将收到通知。 My question is
我的问题是
Thanks. 谢谢。 Help is much appreciated!
非常感谢帮助!
You can check if the token is updated by using the FIRMessagingDelegate
protocol in your App delegate. 您可以使用App委托中的
FIRMessagingDelegate
协议检查令牌是否已更新。 Use the didRefreshRegistrationToken
method to get the updated token 使用
didRefreshRegistrationToken
方法获取更新的令牌
func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) {
print("Firebase registration token: \(fcmToken)")
}
If the token is updated replace the current token with the updated one. 如果令牌已更新,请用已更新的令牌替换当前令牌。
FCM token does not expire.
FCM令牌不会过期。 It changes though on following situations:
在以下情况下,它会发生变化:
The app deletes Instance ID.
该应用程序删除实例ID。
The app is restored on a new device.
该应用已还原到新设备上。
The user uninstall/reinstall the app.
用户卸载/重新安装应用程序。
The user clears app data.
用户清除应用程序数据。
print(FIRInstanceID.instanceID().token())
Follow below answer to have uniformity in registering devices with different OS version for push notification. 请遵循以下答案,以统一注册具有不同操作系统版本的设备以进行推送通知。
https://stackoverflow.com/a/41279265/2432338
https://stackoverflow.com/a/41279265/2432338
Hope this helps you!! 希望这对您有帮助!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.