quickstart-ios: Can't subscribe to topic
I’m trying to subscribe to a topic using the following code (from device):
func connectToFcm() {
FIRMessaging.messaging().connectWithCompletion { (error) in
if (error != nil) {
print("Unable to connect with FCM. \(error)")
} else {
print("Connected to FCM.")
FIRMessaging.messaging().subscribeToTopic("/topics/default-notifications-channel")
}
}
}
The debugger shows the following message:
<FIRMessaging/WARNING> Failed to subscribe to topic Error Domain=com.google.fcm Code=5 "(null)"
I can receive device targeted notifications so APNS configuration is working correctly.
Using Firebase (3.8.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Using FirebaseMessaging (1.2.1)
Any ideas? Thank you!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 53 (11 by maintainers)
As an update: we have identified the issue and have a solution, we are working on getting it published ASAP, I will update here as soon as it is available. Sorry for the delay!
@kroikie It’s been over two months since you said you guys were looking into it. This is a pretty big issue with the SDK and its reliability. What’s going on?
Why is Google ignoring us??
Could you take a look at the inconsistency in the /topic prefix while you’re at it? The latest iOS SDK documentation says
For the first argument. However, if one supplies “sports”, the console complains that it is not prefixed with “/topics/”.
It works when it looks like this:
FIRMessaging.messaging().subscribe(toTopic: "/topics/myTopic")
It does not work without /topics/ prefixed. This inconsistency is very confusing.
Also, may I suggest creating a method for subscribing to multiple topics, such as:
It’s cleaner and should make it easier for you guys to program all the subscriptions into one HTTP request.
A delay workaround is ok only in theory, in real world it can’t be done because you can’t know how long the delay should be. Looking forward for the fix.
@kroikie Have the fixed version already released? I can not found it on here https://firebase.google.com/support/release-notes/ios
@All I apologize for the delay in resolving this issue.
As an update: We have identified the issue and a fix is in the works and will be released soon.
Hi @kroikie , when are you going to release the fix? Do you have estimation time?
@kroikie Is there any progress?
@kroikie the problem occurs even when subscribing to a single topic.
Thank you!
3.13 seems to address this issue. Diego commented on my question here: http://stackoverflow.com/questions/42233474/firebase-clear-cached-subscriptions-after-delete (which was also entirely resolved by this update).
Hi! I’m using version FirebaseMessaging (1.2.1) for ios, and I also have this errors in console. But I tried to send messages via curl, and it works fine. Seems like this is just artifact messages, like when sdk tries to send subscription request when previous is failed. Is this possible?
We’re having the exact same issue, and multi-topic subscriptions is very important to us.
Any news?
I have the same issue. Anyone have solution?