Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 无法注册(com.google.iid错误1005。)_Ios_Google Cloud Messaging - Fatal编程技术网

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

Ios 无法注册(com.google.iid错误1005。),ios,google-cloud-messaging,Ios,Google Cloud Messaging,我正在尝试将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.

我正在尝试将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];
在:

一切都开始起作用了。
很高兴…

像往常一样,我一向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];
在:

一切都开始起作用了。
令人高兴的…

您能告诉我您是否必须使用这一行
[[GCMService sharedInstance]startWithConfig:[GCMConfig defaultConfig]]接收简单推送通知?文档对此不清楚。要通过GCM接收简单的推送通知,我需要在两个不同的位置包含该行,如我的回答中所述。请告诉我您是否必须使用该行
[[GCMService sharedInstance]startWithConfig:[GCMConfig defaultConfig]]接收简单推送通知?文档对此不清楚。要通过GCM接收简单的推送通知,我需要在两个不同的位置包含该行,如我的回答中所述。请告诉我您是否必须使用该行
[[GCMService sharedInstance]startWithConfig:[GCMConfig defaultConfig]]接收简单推送通知?文档对此并不清楚。要通过GCM接收简单的推送通知,我需要在两个不同的位置包含该行,如我的回答中所述。