在我的應用程序中,我試圖實現Google帳戶訪問,並且當我初始化它的工作直到登錄會話。在這之後拋出在屏幕下面的錯誤出手Google OAuth錯誤-1001
這裏我的代碼 初始化和方法實現
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!");
}
如何解決這個問題。請幫我解決