0
我正在尝试使用Google联系人API获取Google联系人信息。如何从谷歌联系人API获取谷歌联系人?
我从谷歌所有的身份验证,但我不知道如何调用谷歌联系api。我这样做已经:
NSLog(@"\n\n User Access Token : %@",user.authentication.accessToken);
NSLog(@"\n\n User Refresh Token : %@",user.authentication.refreshToken);
NSLog(@"\n\n Person Token Expire Date : %@",user.authentication.accessTokenExpirationDate);
NSLog(@"\n\n Person Client ID : %@",user.authentication.clientID);
我想下面的代码调用API接触,但得到意外的响应:
响应:文件过早结束。
NSString * urlString = [NSString stringWithFormat:@"https://www.google.com/m8/feeds/contacts/default/full/"];
urlString =[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
//do post request for parameter passing
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:@"application/atom+xml" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:[NSString stringWithFormat:@"Bearer %@",user.authentication.accessToken] forHTTPHeaderField:@"Authorization"];
[theRequest addValue:@"3.0" forHTTPHeaderField:@"GData-Version"];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
这里我取得联系,但在我的应用程序是如何得到的。
在此先感谢。
请给我完美的源代码。我找不到'self.auth'。 @Rebot先生 – Application
我在哪里可以找到'authorizeRequest'? @ Mr.Rebot – Application