2

我知道如何使用 SLRequest 和 TWRequest 发送自定义推文,但是当我发布消息和链接时我没有得到链接。我只收到消息。

代码是:

  NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"Send to text",@"status",@"http://stackoverflow.com/",@"link", nil];
  SLRequest *slRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:[NSURL URLWithString:@"http://api.twitter.com/1.1/statuses/update.json"] parameters:dict];
 [slRequest setAccount:account];//account is ACAcount type object

 [slRequest performRequestWithHandler:^(NSData *responseData,NSHTTPURLResponse *urlResponse, NSError *error){
                                NSLog(@"The responseString:%@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);

                            }];

我认为问题在于发送链接的关键价值。在这里,我使用“链接”键。请帮我。

4

2 回答 2

3

没有更新 URL 的链接之类的参数。您需要将您的 URl 附加到状态并将wrap_links参数设置为 true。它将起作用

//change your dict like below
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:[NSString stringWithFormat:@"Send to text http://stackoverflow.com/"],@"status",@"true",@"wrap_links", nil];
于 2013-03-08T12:48:37.427 回答
0

除了“状态”的键是“消息”之外,Facebook SLRequest 也是如此。

NSDictionary *parameters = [[NSDictionary alloc] initWithObjectsAndKeys:[NSString stringWithFormat:@"Hey %@ check this out http://stackoverflow.com/", self.label.text],@"message",@"true",@"wrap_links", nil];
于 2013-05-09T09:26:38.797 回答