在我的应用程序中,我尝试实现谷歌帐户访问,当我初始化它的工作直到登录会话时。之后它会在屏幕截图中引发以下错误
这是我的代码 初始化和方法实现
static NSString *const kKeychainItemName =nil;
NSString *kMyClientID = @"465568347336.apps.googleusercontent.com";
NSString *kMyClientSecret = @"rKVsWXTlo3M8zqNfofkX0Xrl";
NSString *scope = @"https://www.googleapis.com/auth/userinfo.profile";
GTMOAuth2ViewControllerTouch *viewController;
viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope
clientID:kMyClientID
clientSecret:kMyClientSecret
keychainItemName:kKeychainItemName
delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)];
[self.navigationController presentModalViewController:viewController animated:YES];
错误处理程序
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (error != nil) {
NSString *output=nil;
output = [error description];
NSLog(@"output:%@",output);
UIAlertView *fail = [[UIAlertView alloc] initWithTitle:@"Alert"
message:[NSString stringWithFormat:@"Error, Authentication failed!\n %@",error]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:@"Try again", nil];
fail.tag = 1;
[fail show];
NSLog(@"Authentication failed!");
} else {
UIAlertView *success = [[UIAlertView alloc] initWithTitle:@"Alert"
message:[NSString stringWithFormat:@"Authentication succeeded!"]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
success.tag = 2;
[success show];
NSLog(@"Autzentication succeeded!");
}
如何解决这个问题。请帮我解决