无法注册(com.google.iid错误1005.)

我正在尝试将GCM整合到我们的iOS应用程序中。 我按照说明更新我们的GCM项目无济于事。 我尝试注册的所有东西我都会得到:

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

哪个GLLInstance.h说:

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

我打电话给:

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

在注册通知之前…从GCM没有任何明显的错误这是在一个设备上…(只是想消除明显​​的)

我应该尝试什么后续步骤?

和往常一样,当我向SO发问时,答案就跳出来了。

例程:

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

我知道我在打电话给:

 - (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 *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 

一切开始工作。 愉快…