quickstart-ios icon indicating copy to clipboard operation
quickstart-ios copied to clipboard

Can't subscribe to topic

Open sendoa opened this issue 10 years ago • 53 comments

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!

sendoa avatar Nov 07 '16 09:11 sendoa

Same here. Registering multiple tropics at once.

alibasta avatar Nov 09 '16 10:11 alibasta

I have the same issue with registering multiple topics. Always:

2016-11-09 11:22:52.106: <FIRMessaging/WARNING> Failed to subscribe to topic Error Domain=com.google.fcm Code=5 "(null)"

nilskassube avatar Nov 09 '16 10:11 nilskassube

Yes, same here. Looping through the topics results in errors. As in https://github.com/firebase/quickstart-ios/issues/8 - which is not fixed even though it is closed. I have tried putting 1 second delay between the calls (far from optimal), but even then some of the subscribe calls fail. It would be also great to have callbacks from the subscribeToTopic and unsubscribeFromTopic methods..

olegdynamo avatar Nov 09 '16 13:11 olegdynamo

Hi All, we are looking into the issues when subscribing to many topics.

Also when subscribing to topics from the iOS SDK you should not prepend the topic name with /topics/ just use the topic name.

kroikie avatar Nov 10 '16 01:11 kroikie

Hi @kroikie, thanks for your insight.

The problem occurs even when subscribing to a unique topic. On the other hand, if I subscribe to topics from iOS without prepending the topic name with /topics/ I get the following runtime warning (for a topic called default-notifications-channel):

2016-11-10 09:18:44.562: <FIRMessaging/WARNING> WARNING. Topic name default-notifications-channel should be prefixed with /topics/ as /topics/default-notifications-channel

Thank you!

sendoa avatar Nov 10 '16 08:11 sendoa

@sendoa you are correct, sorry, currently the iOS SDK does currently require the /topics/ prefix.

As for the topic subscriptions failing, they should be retried automatically. Have you tried adding a delay between subscriptions as suggested by @olegdynamo?

kroikie avatar Nov 10 '16 16:11 kroikie

@kroikie the problem occurs even when subscribing to a single topic.

Thank you!

sendoa avatar Nov 11 '16 08:11 sendoa

I have the same issue. Anyone have solution?

rikoap avatar Nov 18 '16 02:11 rikoap

We're having the exact same issue, and multi-topic subscriptions is very important to us.

Any news?

apognu avatar Nov 18 '16 15:11 apognu

Multi-topic subscriptions is very important to anyone!

revolter avatar Nov 23 '16 08:11 revolter

@sendoa If you are seeing the same error when subscribing to a single topic I would suggest you file a support ticket at firebase.google.com/support since I'm not able to reporduce that. Maybe with more information we can get to the bottom of it. Please identify me in the request so that it can be directed to me.

@all: The issue of subscribing to multiple topics is known and we are implementing a fix. Implementing a delay between subscriptions should help in the mean time.

kroikie avatar Nov 30 '16 00:11 kroikie

Hi @kroikie , when are you going to release the fix? Do you have estimation time?

rikoap avatar Nov 30 '16 07:11 rikoap

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.

revolter avatar Nov 30 '16 07:11 revolter

same problem here

pmusolino avatar Dec 15 '16 14:12 pmusolino

Why is Google ignoring us??

alibasta avatar Dec 15 '16 14:12 alibasta

@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.

kroikie avatar Dec 16 '16 00:12 kroikie

@kroikie do you have news about this issue?

pmusolino avatar Dec 21 '16 09:12 pmusolino

My workaround was a delay between subscriptions.

bennsandoval avatar Dec 21 '16 19:12 bennsandoval

@kroikie Have the fixed version already released? I can not found it on here https://firebase.google.com/support/release-notes/ios

rikoap avatar Jan 03 '17 06:01 rikoap

@kroikie Is there any progress?

kiyotakagoto avatar Jan 11 '17 14:01 kiyotakagoto