Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect to FCM. Error Domain=com.google.fcm Code=2001

I am trying to send from my iOS-Objective-C app a message using:

    NSInteger iTime = [NSDate timeIntervalSinceReferenceDate];
    NSString *strID = [NSString stringWithFormat:@"%@%ld", setting.uid, (long)iTime];
    NSDictionary *msg = @{@"title": @"My iOS-APP",
                          @"text": @"Message from the app"};
    [[FIRMessaging messaging]sendMessage:msg to:setting.uid  withMessageID:strID timeToLive:240];

My app connect correctly to FCM in the AppDelegate. But when sending the message above, after a couple of minutes I get the following error:

Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)"

Searching in the last days I have found a lot of suggesting, but even applying them, I don't success in sending the message. Hopefully someone out there SO had the same problem and found the solution.

like image 687
Dietmar Schwarz Webers Avatar asked Jul 02 '16 14:07

Dietmar Schwarz Webers


People also ask

Does FCM work with Firefox?

The FCM JavaScript API lets you receive notification messages in web apps running in these browsers: Chrome: 50+ Firefox: 44+ Opera Mobile: 37+

What is FCM certificate?

Food contact materials and articles (FCMs) destined for certain markets are required to be tested by designated (approved) laboratories and/or certified by Certification Bodies before they can access these important markets.


1 Answers

This code error 2001 is shown because, When you send the message the application is already connected to FCM. You are trying to connected again to FCM that is the reason the message. Some part of your code When you are trying send message you try to connect again.

like image 148
Gianfranco Lemmo Avatar answered Oct 15 '22 18:10

Gianfranco Lemmo