2016-01-06 64 views
0

我正在整合iOS的谷歌实例id api,并调用相应的方法如下 以获取实例ID。 。没有收到谷歌实例id为iOS的实例id

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

GGLInstanceID.sharedInstance()getIDWithHandler {(身份,错误) - >空隙中 如果让ERR =错误{ 打印(ERR) } 否则{ self.instanceID =同一性 } }

但是我得到这个错误

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

我跟着documen在this url

任何帮助将不胜感激。

回答

3

您是否找到解决问题的方法?

我遇到了同样的错误,我想通了。这是Obj-C的代码,但我认为它是相同的迅速。问题是配置初始化。

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]; 
+0

感谢您的回答。现在我正在获取应用程序的实例ID,但还有一个关于获取设备令牌的问题。我已经使用了与上面相同的代码来获取设备标记,并在iidInstance上使用tokenWithAuthorizedEntity方法,但没有获得它。我已经将options参数设置为nil.so plz合作关于什么值必须在tokenWithAuthorizedEntity方法的选项字典参数中输入?获取设备标记时出现以下错误 错误域= com.google.iid代码= 1001“(null)” – Prathamesh