【问题标题】:Not receiving instance id with google instance id api for iOS未使用适用于 iOS 的 google instance id api 接收实例 id
【发布时间】:2016-01-06 12:14:05
【问题描述】:

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

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

GGLInstanceID.sharedInstance().getIDWithHandler { (identity, error) -> Void in 如果让错误=错误{ 打印(错误) } 别的{ self.instanceID = 身份 } }

但是我得到了这个错误

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

我关注了this url 上的文档

任何帮助将不胜感激。

【问题讨论】:

    标签: ios swift instanceid


    【解决方案1】:

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

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

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

    【讨论】:

    • 感谢您的回答。现在我正在获取应用程序的实例 ID,但还有一个关于获取设备令牌的问题。我已经使用与上面相同的代码在 iidInstance 上使用 tokenWithAuthorizedEntity 方法获取设备令牌但没有得到它。我已将选项参数设置为 nil。所以请合作关于必须在 tokenWithAuthorizedEntity 方法的选项字典参数中输入哪些值?获取设备令牌时出现以下错误 Error Domain=com.google.iid Code=1001 "(null)"
    猜你喜欢
    • 2018-03-21
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    • 2015-12-21
    • 1970-01-01
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    相关资源
    最近更新 更多