【问题标题】:How to use the existed sample application to integrate google credentials in the iphone app如何使用现有的示例应用程序将 google 凭据集成到 iphone 应用程序中
【发布时间】: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


    【解决方案1】:

    搜索这个方法

    • (GDataServiceGoogleContact *)contactService

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 2011-04-12
      • 1970-01-01
      相关资源
      最近更新 更多