0

iOS 用の Google インスタンス ID API を統合し、次のように適切なメソッドを呼び出してインスタンス 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 } }

ただし、このエラーが発生しました

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

私はこのURLのドキュメントに従いました

どんな助けでも大歓迎です。

4

1 に答える 1

3

問題の解決策は見つかりましたか?

私は同じエラーに遭遇し、それを理解しました。これは 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];
于 2016-03-14T11:08:46.697 に答える