Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS GCM - GGLInstanceID | Invalid last checkin timestamp in future

We started noticing this error today upon running our app. We haven't been able to find anything related to this on the interwebs. Is this just an issue with GCM or some order of operations we need to sort out?

2015-12-23 11:44:01.411: GGLInstanceID | Invalid last checkin timestamp in future.
2015-12-23 11:44:01.471: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "(null)"
like image 438
djneely Avatar asked Nov 08 '22 23:11

djneely


1 Answers

Not 100% sure this is the be-all-end-all fix to this but I am no longer seeing the issue and I believe its just due to order of operations. Below is the order I'm using that seems to be doing ok.

In AppDelegate didFinishLaunchingWithOptions:

let instanceIDConfig = GGLInstanceIDConfig.defaultConfig();
instanceIDConfig.delegate = self
GGLInstanceID.sharedInstance().startWithConfig(instanceIDConfig)

In AppDelegate didRegisterForRemoteNotificationsWithDeviceToken:

gcmRegistrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken, kGGLInstanceIDAPNSServerTypeSandboxOption:true];
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID,
                scope: kGGLInstanceIDScopeGCM,
                options: gcmRegistrationOptions,
                handler: gcmRegistrationHandler);

In AppDelegate gcmRegistrationHandler:

if let _ = registrationToken {
     //REGISTER TOKEN WITH BACKEND
}

In AppDelegate onTokenRefresh:

GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID,
            scope: kGGLInstanceIDScopeGCM,
            options: gcmRegistrationOptions,
            handler: gcmRegistrationHandler)
like image 136
djneely Avatar answered Nov 14 '22 22:11

djneely