我知道如何使用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]);
}];
我认为问题在于发送链接的关键价值。在这里,我使用'链接'键。请帮帮我。
答案 0 :(得分:3)
没有像更新网址链接这样的参数。
你需要将你的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];
答案 1 :(得分: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];