我想从我的LinkedIn个人资料中获取所有朋友。请建议我任何教程。
我的代码是:
NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/connections:(id,first-name,last-name,email-address,picture-url,Positions)"];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url
consumer:self.oAuthLoginView.consumer
token:self.oAuthLoginView.accessToken
callback:nil
signatureProvider:nil];
[request setValue:@"json" forHTTPHeaderField:@"x-li-format"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(profileApiCallResult:didFinish:)
didFailSelector:@selector(profileApiCallResult:didFail:)];
答案 0 :(得分:0)
您可以将此用于连接:For request part see this.
- (void)connectionsApiCallResult:(LOAServiceTicket *)ticket didFinish:(NSData *)data
{
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"connectionsApiCallResult====%@",responseBody);
[responseBody release];
}
- (void)connectionsApiCallResult:(LOAServiceTicket *)ticket didFail:(NSError *)error
{
NSLog(@"%@",[error description]);
}
-(void)GetConnectionsCall
{
NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/connections:(headline,first-name,last-name,picture-url,id)"];
LOAMutableURLRequest *request =
[[LOAMutableURLRequest alloc] initWithURL:url
consumer:self.consumer
token:TestAccessToken
callback:nil
signatureProvider:nil];
[request setValue:@"json" forHTTPHeaderField:@"x-li-format"];
LOADataFetcher *fetcher = [[[LOADataFetcher alloc] init] autorelease];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(requestTokenResult:didFinish:)
didFailSelector:@selector(requestTokenResult:didFail:)];
}
答案 1 :(得分:0)
请尝试以下步骤
在下面的行中编辑范围。
OARequestParameter *nameParam = [[OARequestParameter alloc] initWithName:@"scope"
value:@"r_fullprofile+rw_nus+r_network"];
OARequestParameter * scopeParameter=[OARequestParameter requestParameter:@"scope"
value:@"r_fullprofile rw_nus r_network"];