2013-03-08 18 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]; 
相關問題