【问题标题】:Not able to fetch the gmail address book in iPhone无法在 iPhone 中获取 gmail 通讯录
【发布时间】:2014-04-07 17:28:55
【问题描述】:

从最近几天开始,由于无法在我的 iPhone 应用程序中访问我的 gmail 通讯录,我陷入了困境。我进行了很多搜索,但没有获得任何成功。 这是我参考的链接 I checked this link also to access gmail contacts

在上面的链接中,您可以使用此 url 访问联系人 https://www.google.com/m8/feeds/contacts/userEmail/full 我可以使用 GData 框架登录,但没有找到任何可以获取 gmail 联系人的内容。 成功登录后我有一个访问令牌,我在成功登录后调用此方法。

- (void)doAnAuthenticatedAPIFetch {
    NSString *urlStr = @"https://www.google.com/m8/feeds/contacts/myEmailId@gmail.com/full";
    NSURL *url = [NSURL URLWithString:urlStr];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    [self.authToken authorizeRequest:request
              completionHandler:^(NSError *error) {
                  NSString *output = nil;
                  if (error) {
                      output = [error description];
                  } else {
                      NSURLResponse *response = nil;
                      NSData *data = [NSURLConnection sendSynchronousRequest:request
                                                           returningResponse:&response
                                                                       error:&error];
                      if (data) {
                          // API fetch succeeded :Here I am getti
                          output = [[NSString alloc] initWithData:data
                                                         encoding:NSUTF8StringEncoding];
                      } else {
                          // fetch failed
                          output = [error description];
                      }
                  }
              }];

}

请指导我。

【问题讨论】:

    标签: iphone ios7 gmail


    【解决方案1】:

    使用此 URL 获取 gmail 帐户通讯录。

    http://code.google.com/p/gdata-objectivec-client/wiki/GDataObjCIntroduction

    并从这里获取如何使用 google api 的说明。

    http://johntwang.com/blog/2009/06/08/how-to-use-google-apis-with-iphone-sdk/

    希望这对你有用。

    【讨论】:

    • 我也用过这个链接,可以登录但无法获取gmail通讯录
    猜你喜欢
    • 1970-01-01
    • 2011-07-19
    • 1970-01-01
    • 1970-01-01
    • 2012-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-12
    相关资源
    最近更新 更多