iOS - Runtime errors with GCM - ios

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!

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.

Related

iOS Firebase Remote Config --- Error Domain=com.google.remoteconfig.ErrorDomain Code=8003

I am using Firebase's Remote Config here on iOS, whether I call fetchAndActivateWithCompletionHandler or fetchWithExpirationDuration and activateWithCompletion, I have encountered such an error:
Error Domain=com.google.remoteconfig.ErrorDomain Code=8003 "Failed to
get installations token.
For this problem, has a friend already solved it? Thx!
I call fetchAndActivateWithCompletionHandler
or fetchWithExpirationDuration and activateWithCompletion, but no solve it.

Firebase Phone Authentication Error: Invalid Token (Even after replacing APNs Key)

Today may production app started having issues on Phone Authentication through Firebase on several devices (but not all).
When I make the call PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber: uiDelegate:) I get the following error:
Error Domain=FIRAuthErrorDomain Code=17048 "Invalid token." UserInfo={NSLocalizedDescription=Invalid token., error_name=INVALID_APP_CREDENTIAL
As per Firebase documentation, this code indicates that an invalid APNS device token was used in the verifyClient request.
Nothing in my app code has changed, yet this error is occurring. I uploaded a new APNs Key and .p8 file as other StackOverflow posts have suggested, with no luck.
I have tried the suggestions in this similar post.
I am also able to receive push notifications from my app to this device, so it isn't like my push notifications aren't working.
Could anyone suggest ways of debugging his?
Edit: This is the method I am calling:
func sendVerificationCode(to phoneNumber: String, _ completion: #escaping (Error?)->Void) {
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in
/* store verificationID locally if exists */
completion(error)
}
}
firebaser here
There was an issue where iOS clients were not receiving the text messages required for one-time password authentication. Its status is being tracked here: https://status.firebase.google.com/incident/Authentication/18006
From there:
We are investigating an issue with Firebase Phone authentication that affects iOS devices. Affected customers may see "invalid token" error during OTP verification.
This issue has been fixed, since 11:15 am pacific time. If you're still seeing similar problems, reach out to Firebase support for personalized help in troubleshooting.

"Error Domain=com.google.iid Code=501" while registering ios devicetoken in gcm

GLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.).
Please get me out of this.
The error log message GLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 is traced often, both when receiving google token succeeds or fails. I assume this is not an actual error.
I started receiving the error Error Domain=com.google.iid Code=501 on one device. No matter how many times I retried the call to tokenWithAuthorizedEntity:scope:options:handler: it always returned 501. I tried deleting the app, I tried restarting the device with no luck. I noticed that the same code ran fine on other devices. As a final resort I reset all data and settings on the device (factory reset) and this fixed the problem for me.

GCM registration successful on iphone but not ipad

I have a weird issue where I receive the following error only on an ipad device:
The operation couldn’t be completed. (com.google.iid error 501.)
During the GCM registration process to request a gcm token. i.e.
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID,
scope: kGGLInstanceIDScopeGCM,
options: gcmRegistrationOptions,
handler: gcmRegistrationHandler)
I'm following the example to the letter. The same process works just fine on an iphone. I'm not sure what the difference between the two devices are and why GCM refuses to register on the ipad. Both devices are currently running iOS 9.3.1.
The header file indicates that this error corresponds to:
// Device seems to be missing a valid deviceID. Cannot
// authenticate device requests.
kGGLInstanceIDOperationErrorCodeMissingDeviceID = 501,
However, I'm not sure exactly what that means. Why would the iPad be missing a deviceID, but the iphone is OK?
If anyone has any ideas on why this is happening and can share some insight, I'd greatly appreciate it.
Thanks!
In the end we transitioned to Firebase as recommended by Google recently. Everything worked as expected.

Cloudant replication errors: TDChangeTracker (Code=589) and NSURLErrorDomain(Code=-1005)

I have been using Cloudant through Bluemix and everything worked fine at the beginning. But now the replications don't complete successful anymore, constantly throwing errors or finishing with no data being received.
replicatorDidError: Error Domain=NSURLErrorDomain Code=-1005 "(null)"
replicatorDidError: Error Domain=TDChangeTracker Code=589 "(null)"
Bad DB response: {"error":"service_unavailable","reason":"Service unavailable"}
Sometimes it was temporarily fixed assigning new credentials, but now it doesn't do the trick anymore. It happens either from the iOS SDK or from a node.js app.
Any help will be very welcome.
Thanks in advance.

Resources