注册令牌始终为零并显示此错误:无法完成操作。 (com.google.iid错误0。)
AppDelegate.m
GGLInstanceIDConfig *instanceIDConfig = [GGLInstanceIDConfig defaultConfig];
instanceIDConfig.delegate = self;
[[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
[[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:@"mySenderID"
scope:kGGLInstanceIDScopeGCM
options:registrationOptions
handler:registrationHandler];
registrationHandler = ^(NSString *registrationToken, NSError *error){
if (registrationToken != nil) {
myRegistrationToken = registrationToken;
NSLog(@"Registration Token: %@", registrationToken);
NSDictionary *userInfo = @{@"registrationToken":registrationToken};
} else {
NSLog(@"Registration to GCM failed with error: %@", error.localizedDescription);
}
};