Iām not 100% sure that this is all the same to fix it, but I no longer see the problem, and I believe that this is simply due to the order of operations. Below is the order I'm using, which seems to work fine.
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 {
In AppDelegate onTokenRefresh:
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: gcmRegistrationOptions, handler: gcmRegistrationHandler)
source share