LinkedIn集成r_network和w_messages请求不在iOS sdk中一起工作

时间:2013-07-22 10:40:30

标签: iphone ios objective-c ipad linkedin

我已经完成了LinkedIn集成,我必须向特定用户发送消息。为此,我首先获取连接然后发送消息。

(void)requestTokenFromProvider { OAMutableURLRequest *request = [[[OAMutableURLRequest alloc] initWithURL:requestTokenURL consumer:self.consumer token:nil callback:linkedInCallbackURL signatureProvider:nil] autorelease];

[request setHTTPMethod:@"POST"];

OARequestParameter *nameParam = [[OARequestParameter alloc] initWithName:@"scope" value:@"r_basicprofile+w_messages+r_network"];

NSArray *params = [NSArray arrayWithObjects:nameParam, nil]; [request setParameters:params];

OARequestParameter * scopeParameter=[OARequestParameter requestParameter:@"scope" value:@"r_basicprofile"];

[request setParameters:[NSArray arrayWithObject:scopeParameter]];

OARequestParameter * networkParameter=[OARequestParameter requestParameter:@"scope" value:@"w_messages"];

[request setParameters:[NSArray arrayWithObject:networkParameter]];

OARequestParameter * netParameter=[OARequestParameter requestParameter:@"scope" value:@"r_network"];

[request setParameters:[NSArray arrayWithObject:netParameter]];

OADataFetcher *fetcher = [[[OADataFetcher alloc] init] autorelease]; [fetcher fetchDataWithRequest:request delegate:self didFinishSelector:@selector(requestTokenResult:didFinish:) didFailSelector:@selector(requestTokenResult:didFail:)]; }

当我发送对w_messages和r_network的请求时,其中一个不起作用,输出为“Access To connections Denied”或“Access to sending invitation denied。”

如果我单独使用r_basicprofile然后它们工作正常但是当我一起使用它们时,其中一个访问被拒绝。我没有得到任何线索。请帮助。

1 个答案:

答案 0 :(得分:3)

我刚刚得到了解决方案。在请求部分我需要像这样传递。

OARequestParameter *nameParam = [[OARequestParameter alloc] initWithName:@"scope" value:@"r_basicprofile+w_messages+r_network"];

 NSArray *params = [NSArray arrayWithObjects:nameParam, nil];

 [request setParameters:params];

 OARequestParameter * scopeParameter=[OARequestParameter requestParameter:@"scope" value:@"r_basicprofile w_messages r_network"];

[request setParameters:[NSArray arrayWithObject:scopeParameter]];