2

我正在制作一个将 gmail 集成到我的应用程序的应用程序。我可以通过 gadata-objective c-client-1.11.0.a 登录到 gmail。我给代码

-(IBAction)googlelogin
{
    NSString *scope = @"https://www.googleapis.com/auth/plus.me"; // scope for Google+ API

    GTMOAuth2ViewControllerTouch *viewController = [[[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope clientID:kMyClientID clientSecret:kMyClientSecret keychainItemName:nil delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)] autorelease];

    NSString *html = @"<html><body><div align=center>Loading sign-in page...</div></body></html>";
   [viewController setInitialHTMLString:html];

   [self presentModalViewController:viewController animated:NO];        

}

现在我想在谷歌登录后重定向回我的应用程序以获取 gmail 的联系人。帮助我如何在登录后生成已拍摄并返回我的应用程序

谢谢

4

1 回答 1

0

你应该实现这个方法

- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
  finishedWithAuth:(GTMOAuth2Authentication *)auth
             error:(NSError *)error {
 if (error != nil) {
  // Authentication failed
 }   else {
     // Authentication succeeded
   // here you should push your the root view controller of your app.
 }

}

于 2012-11-22T08:36:25.953 回答