用于在linkedIn中发布标题,描述和链接的URL

时间:2011-12-03 07:07:01

标签: iphone social-networking linkedin

我需要从我的iphone应用程序发布在linkedIn的墙上。

我正在从the source下载代码。

在此处对于墙上的帖子代码是

- (RDLinkedInConnectionID *)updateStatus:(NSString *)newStatus {
  NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/current-status"]];
  newStatus = [newStatus length] > kRDLinkedInMaxStatusLength ? [newStatus substringToIndex:kRDLinkedInMaxStatusLength] : newStatus;
  NSData* body = [RDLinkedInRequestBuilder buildSimpleRequestWithRootNode:@"current-status" content:newStatus];
  return [self sendAPIRequestWithURL:url HTTPMethod:@"PUT" body:body];
} 

这是仅发布当前状态的代码,但我需要发布标题,说明和网址,如facebook。

我怎么能这样做,任何人都可以帮助我。

1 个答案:

答案 0 :(得分:0)

我使用sharelink方法解决它。对于thais的代码是

-(RDLinkedInConnectionID *)shareLink:(NSDictionary *)shareDict { 
    NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/shares"]];   
    NSString *xmlStr = [NSString stringWithFormat:@"<share><content><title>%@</title><submitted-url>%@</submitted-url><description>%@</description></content><visibility><code>anyone</code></visibility></share>",[shareDict objectForKey:@"Title"],[shareDict objectForKey:@"Link"],[[shareDict objectForKey:@"Description"]substringWithRange:NSMakeRange(0,150)]];  
    NSData* body = [xmlStr dataUsingEncoding:NSUTF8StringEncoding]; 
    return [self sendAPIRequestWithURL:url HTTPMethod:@"POST" body:body];
}