我正在制作一个将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的联系人。帮我告知如何生成并在登录后返回我的应用程序
谢谢
答案 0 :(得分: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.
}
}