【发布时间】: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];
}
}
}];
}
请指导我。
【问题讨论】: