Rocco Zanni
Rocco Zanni

Reputation: 62

iOS - Runtime errors with GCM

I'm not sure if this is an issue of the library or something wrong on our side but I already spent a lot of time searching about this and found nothing that could shed any light.

We're using GCM since a while on both iOS and Android. The application is in production and is working fine. Our iOS app collects and reports low-impact errors (basically errors we catch and handle) and analyzing these data I found those errors I'm struggling to understand.

While registering a device on GCM with an APNS token

Error Domain=com.google.iid Code=1006 "(null)" that according to the documentation is kGGLInstanceIDOperationErrorCodeInvalidKeyPair

While subscribing to a topic

Error Domain=com.google.gcm Code=501 "(null)" that according to the documentation is kGGLInstanceIDOperationErrorCodeMissingDeviceID

Both errors happens on iOS8/iOS9/iOS10.

Our app includes the GCM library via Cocoapods:

pod 'Google/CloudMessaging', '2.0.4'

Can someone help me understanding what's happening?

Thanks!

Upvotes: 1

Views: 65

Answers (1)

abielita
abielita

Reputation: 13469

The first error kGGLInstanceIDOperationErrorCodeInvalidKeyPair means that you have error in KeyPair access. While the error kGGLInstanceIDOperationErrorCodeMissingDeviceID means that your device seems to be missing a valid deviceID. It cannot authenticate device requests. From this related thread, error code 501 was solved by resetting all data and settings on the device (factory reset) and this fixed the problem. It's also stated here that the error occurred maybe because you are calling GCMService.sharedInstance().connectWithHandler() { error in if(error != nil) { print(error) } } before you had received a registration token, or had failed to refresh your token.

But I found this SO question which have similar issue with you which suggests to transition to Firebase Cloud Messaging as recommended by Google and his issue was solved.

Upvotes: 1

Related Questions