提问者:小点点

未接收具有适用于 iOS 的谷歌实例 ID API 的实例 ID


我正在集成iOS版的google实例id api,并调用如下适当的方法来获取实例id。

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

GGLInstanceID.sharedInstance()。getIDWithHandler { (identity,error) -

然而,我得到了这个错误

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

我遵循了这个url上的文档

任何帮助将不胜感激。


共1个答案

匿名用户

你找到解决问题的方法了吗?

我遇到了同样的错误,我想通了。这是Obj-C代码,但我假设它在swft中是一样的。问题是配置初始化。

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