如何使用现有的示例应用程序将谷歌凭证集成到iPhone应用程序中

发布于 2024-10-17 03:00:55 字数 2049 浏览 8 评论 0原文

我从下面的链接下载了 .zip 文件,其中包含一些示例。在其中我玩了 OAuthSampleTouch 应用程序。

http://code.google.com/p/gdata-objectivec-client/downloads/list

这是我下载的文件: gdata-objectivec-client-1.11.0.zip

我已经完成了它,但我很困惑如何传递电子邮件和密码输入,然后如何通过谷歌从我的 iPhone 应用程序进行连接。

新编辑的代码: 这是“OAuthSampleRootViewControllerTouch.m”类中 OAuthSampleTouch 示例的代码,请参阅 http该 OAuthSampleTouch 应用程序中的 ://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 示例的代码,请检查它。我需要传递凭据的范围是什么以及从哪里?如果我运行此命令,我将收到日志作为身份验证错误:

请帮助我,我从三天开始尝试。

非常感谢任何帮助。

谢谢你, 马丹·莫汉。

From the below link I download the .zip file it contains some example. In that I played the OAuthSampleTouch application.

http://code.google.com/p/gdata-objectivec-client/downloads/list

This is the file I downloaded :
gdata-objectivec-client-1.11.0.zip

I gone through it but I am getting confusion how to pass input that is email and password and then how to connect through google form my iphone app.

Newly edited code:
This is code from OAuthSampleTouch example in the class "OAuthSampleRootViewControllerTouch.m" Please refer http://code.google.com/p/gdata-objectivec-client/downloads/list in that OAuthSampleTouch application.

- (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];
}

This is code from OAuthSampleTouch example in the class "OAuthSampleRootViewControllerTouch.m" Please check it. What is the scope and from where I need to pass credentials. If I run this I am getting the log as Authentication error:

Please help me, I am trying it from three days.

Any help is much appreciated.

Thank you,
Madan Mohan.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九公里浅绿 2024-10-24 03:00:55

搜索此方法

  • (GDataServiceGoogleContact *)contactService

在这里您将提供谷歌帐户的用户名和密码。

Search for this method

  • (GDataServiceGoogleContact *)contactService

Here you will be giving username and password for google account..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文