FCM主题 - 无法订阅主题:xxx with token:(null) - iOS [英] FCM topic - Cannot subscribe to topic: xxx with token: (null) - iOS
本文介绍了FCM主题 - 无法订阅主题:xxx with token:(null) - iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从Firebase Messaging API收到此错误?:
I'm getting this error from Firebase Messaging API:
[Firebase/Messaging][I-FCM002010] Cannot subscribe to topic: /topics/testTopic with token: (null)
但之前:
Messaging.messaging().subscribe(toTopic: "/topics/testTopic")
我打印出这样的代币:
print("TOKEN: \(InstanceID.instanceID().token() ?? "NO TOKEN")")
其结果是:
TOKEN:cXPhGQ_inE4:APA91bEKZF5depHmIm9gDliCFRCRcnJf5LYy5FMg6nhpWvKU3o3HEtr1WTBHUiCZXT4XzhVg2oqXzhtfrgf83brtLdqXii546644ciMPO80tri4JPueQBClKbaomEfoh54ku8E2lw
因此令牌不是 null 。
我做错了什么?有人帮忙吗?
Am I doing something wrong? Anyone some help?
推荐答案
问题是我想订阅 didFinishLaunchingWithOptions
但是这一点并非所有服务都已设置。
解决方案在委托中订阅 didRegisterUserNotificationSettings
。
The problem was that I wanted to subscribe in didFinishLaunchingWithOptions
but in that point not all services were set up.
The solution was to subscribe in the delegate didRegisterUserNotificationSettings
.
这篇关于FCM主题 - 无法订阅主题:xxx with token:(null) - iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文