【发布时间】:2011-02-12 10:33:52
【问题描述】:
我从下面的链接下载了包含一些示例的 .zip 文件。在那里我玩了 OAuthSampleTouch 应用程序。
http://code.google.com/p/gdata-objectivec-client/downloads/list
这是我下载的文件: gdata-objectivec-client-1.11.0.zip
我已经完成了,但我很困惑如何传递电子邮件和密码输入,然后如何通过谷歌连接到我的 iPhone 应用程序。
新编辑的代码: 这是“OAuthSampleRootViewControllerTouch.m”类中 OAuthSampleTouch 示例中的代码,请参阅该 OAuthSampleTouch 应用程序中的 http://code.google.com/p/gdata-objectivec-client/downloads/list。
- (void)signInToGoogle
{
[self signOut];
NSString *keychainAppServiceName = nil;
if ([self shouldSaveInKeychain])
{
keychainAppServiceName = kAppServiceName;
}
// For GData applications, the scope is available as
// NSString *scope = [[service class] authorizationScope];
NSString *scope = @"http://www.google.com/m8/feeds/";
// ### Important ###
// GDataOAuthViewControllerTouch is not designed to be reused. Make a new
// one each time you are going to show it.
// Display the autentication view.
GDataOAuthViewControllerTouch *viewController = [[[GDataOAuthViewControllerTouch alloc]
initWithScope:scope
language:nil
appServiceName:keychainAppServiceName
delegate:self
finishedSelector:@selector(viewController:finishedWithAuth:error:)] autorelease];
// You can set the title of the navigationItem of the controller here, if you want.
// Optional: display some html briefly before the sign-in page loads
NSString *html = @"<html><body bgcolor=silver><div align=center>Loading sign-in page...</div></body></html>";
[viewController setInitialHTMLString:html];
[[self navigationController] pushViewController:viewController animated:YES];
}
这是“OAuthSampleRootViewControllerTouch.m”类中 OAuthSampleTouch 示例中的代码,请检查。范围是什么,我需要从哪里传递凭据。如果我运行它,我会得到日志作为身份验证错误:
请帮帮我,我正在尝试从三天开始。
非常感谢任何帮助。
谢谢你, 马丹·莫汉。
【问题讨论】:
标签: iphone objective-c gdata