0
votes

I am integrating google instance id api for iOS and called the appropriate method as follows to get an instance id.

 let gcmConfig = GCMConfig.defaultConfig()
    gcmConfig.receiverDelegate = self
    GCMService.sharedInstance().startWithConfig(gcmConfig)

GGLInstanceID.sharedInstance().getIDWithHandler { (identity, error) -> Void in if let err = error { print(err) } else{ self.instanceID = identity } }

However i got this error

Error Domain=com.google.iid Code=1005 "(null)"

i followed the documentation on this url

Any help would be greatly appreciated.

1

1 Answers

3
votes

Did you find a solution to your problem ?

I ran into the same error and i figured it out. It's Obj-C code but i assume it's the same in swift. The problem was the config initialization.

GGLInstanceIDConfig *config = [GGLInstanceIDConfig defaultConfig];
[[GGLInstanceID sharedInstance] startWithConfig:config];
GGLInstanceID *iidInstance = [GGLInstanceID sharedInstance];

GGLInstanceIDHandler handler = ^void(NSString *identity, NSError *error) {
    if (error) {
        NSLog(@"error %@", [error description]);
    } else {
        // handle InstanceID for the app
       NSLog(@"Success! ID = %@", identity);
 }

[iidInstance getIDWithHandler:handler];