发送消息API错误
我正在从iphone应用程序发送带有XML body的发送消息请求发送消息API错误,api,iphone-sdk-3.0,linkedin,Api,Iphone Sdk 3.0,Linkedin,我正在从iphone应用程序发送带有XML body的发送消息请求 <mailbox-item><recipients><recipient><person path='/people/93619553' /></recipient><recipient><person path='/people/116008244' /></recipient><recipient><person
<mailbox-item><recipients><recipient><person path='/people/93619553' /></recipient><recipient><person path='/people/116008244' /></recipient><recipient><person path='/people/96885725' /></recipient></recipients><subject>Message from butterfli</subject><body>Aasd</body></mailbox-item>
代码是
- (RDLinkedInConnectionID *)sendMessage:(NSDictionary *)shareDict {
NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/mailbox"]];
NSString *xmlStr = @"<mailbox-item><recipients>";
NSArray *toIdArray = [[shareDict objectForKey:@"privacy"] componentsSeparatedByString:@","];
for (int l=0; l<[toIdArray count]; l++) {
xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"<recipient><person path='/people/%@' /></recipient>",
[toIdArray objectAtIndex:l]]];
}
xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"</recipients><subject>%@</subject><body>%@</body></mailbox-item>",
@"Message from butterfli",[shareDict objectForKey:@"text_message"]]];
[NSString stringWithFormat:@"<share><comment>%@</comment><content><submitted-url>%@</submitted-url></content><visibility><code>anyone</code></visibility></share>",
[shareDict objectForKey:@"link_msg"],[shareDict objectForKey:@"link"]];
NSData *body = [xmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"xmlStr..%@",xmlStr);
return [self sendAPIRequestWithURL:url HTTPMethod:@"POST" body:body];
}
阿米特·巴坦(Amit Battan)这不是一个已经解决的问题 但现在的解决办法是 完成了…
在此之前,我对Web上用户配置文件URL中显示的用户id进行了硬编码。
但通过API访问的用户id可以正常工作。
但不明白为什么linkedin用户的ID不同 as
LinkedIn为每个用户/应用程序组合使用唯一的用户ID,以保护用户隐私。只有最初请求(并获得)成员身份验证的应用程序才能使用该令牌检索更多信息。
请将此代码发送给我
- (RDLinkedInConnectionID *)sendMessage:(NSDictionary *)shareDict {
NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/mailbox"]];
NSString *xmlStr = @"<mailbox-item><recipients>";
NSArray *toIdArray = [[shareDict objectForKey:@"privacy"] componentsSeparatedByString:@","];
for (int l=0; l<[toIdArray count]; l++) {
xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"<recipient><person path='/people/%@' /></recipient>",
[toIdArray objectAtIndex:l]]];
}
xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"</recipients><subject>%@</subject><body>%@</body></mailbox-item>",
@"Message from butterfli",[shareDict objectForKey:@"text_message"]]];
[NSString stringWithFormat:@"<share><comment>%@</comment><content><submitted-url>%@</submitted-url></content><visibility><code>anyone</code></visibility></share>",
[shareDict objectForKey:@"link_msg"],[shareDict objectForKey:@"link"]];
NSData *body = [xmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"xmlStr..%@",xmlStr);
return [self sendAPIRequestWithURL:url HTTPMethod:@"POST" body:body];
}