0

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.

praths
  • 353
  • 1
  • 14

1 Answers1

3

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];
Mallox
  • 136
  • 4
  • thanks for your answer .Now I am getting the instance id of an app but one more question about getting device token. I have used the same code as above earlier for getting device token with tokenWithAuthorizedEntity method on iidInstance but not getting it.I have set the options parameter to nil.so plz cooperate about what values have to be entered in options dictionary parameter of tokenWithAuthorizedEntity method? I am getting following error when getting device token Error Domain=com.google.iid Code=1001 "(null)" – praths Mar 17 '16 at 13:34