无法注册(com.google.iid错误1005.) [英] unable to register (com.google.iid error 1005.)

查看:287
本文介绍了无法注册(com.google.iid错误1005.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将GCM整合到我们的iOS应用中。
我按照指示更新我们的GCM项目无济于事。
我尝试注册的所有内容我得到:

  GCM注册失败,错误:操作无法完成。 (com.google.iid error 1005.)

哪个GLLInstance.h说:

  ///在请求令牌之前应该调用`startWithConfig:`。 
kGGLInstanceIDOperationErrorCodeInvalidStart = 1005,

我在打电话:

  [[GCMService sharedInstance] startWithConfig:[GCMConfig defaultConfig]]; 

在注册通知之前...
GCM没有任何明显的错误
这是设备上的内容...
(只是试图消除显而易见的问题)



我应该尝试下几步?

解决方案

像往常一样,当我向SO发布问题时,答案突然出现在我身上。


$ b $例程:

  [[GCMService sharedInstance] startWithConfig:[GCMConfig defaultConfig]]; 

我知道我在打电话:



< pre $ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

之前

  [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings]; 
[[UIApplication sharedApplication] registerForRemoteNotifications];在 两个 位置中需要

。 。 我错过了。
一旦我在调用之前添加它:

  [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:_gcmSenderID 
scope :kGGLInstanceIDScopeGCM
options:_registrationOptions
handler:_registrationHandler];

在:

   - (void)application:(UIApplication *)applicationDisRegisterForRemoteNotificationsWithDeviceToken :( NSData *)deviceToken {



一切都开始奏效。
令人愉快......


I'm attempting to integrate GCM into our iOS app. I've followed the instructions to update our project for GCM to no avail. Everything I try to register I get:

Registration to GCM failed with error: The operation couldn’t be completed. (com.google.iid error 1005.)

Which GLLInstance.h say:

  /// Should call `startWithConfig:` before requesting token.
  kGGLInstanceIDOperationErrorCodeInvalidStart = 1005,

I am calling :

[[GCMService sharedInstance] startWithConfig:[GCMConfig defaultConfig]];

before registering for notifications... There aren't any obvious errors from GCM This IS on a device... (just trying to eliminate the obvious)

What next steps should I try?

解决方案

As usual as soon as I post a question to SO, the answer leaps out at me.

The routine:

[[GCMService sharedInstance] startWithConfig:[GCMConfig defaultConfig]];

which I knew I was calling in:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

right before

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];

was needed in two locations... I missed that. Once I added it just before the call:

[[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:_gcmSenderID
                                                    scope:kGGLInstanceIDScopeGCM
                                                  options:_registrationOptions
                                                  handler:_registrationHandler];

in:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

everything started working. Delightful...

这篇关于无法注册(com.google.iid错误1005.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆