2013-03-08 62 views
2

我知道如何使用SLRequest和TWRequest发送自定义推文,但是当我发布消息和链接时,我没有获得链接。我只收到消息。如何在ios中发送包含链接和图片的自定义推文?

的代码是:

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]); 

          }]; 

我认为这个问题是在发送链路密钥值。这里我使用'link'键。请帮帮我。

回答

3

没有像链接更新URL的参数。 你需要您的网址追加到状态和wrap_links设置为true parameter.It将工作

//change your dict like below 
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:[NSString stringWithFormat:@"Send to text http://stackoverflow.com/"],@"status",@"true",@"wrap_links", nil]; 
+0

感谢您的回答,但我没有得到。请简要解释一下 – 2013-03-08 13:11:45

+0

你好,看我更新的回答 – Narayana 2013-03-08 13:20:45

+0

非常感谢 – 2013-03-08 13:29:03

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]; 
相关问题