使用Accounts框架在iOS 5 Twitter中转发,回复和收藏 [英] Retweet, reply and favorite in iOS 5 Twitter with the Accounts framework
本文介绍了使用Accounts框架在iOS 5 Twitter中转发,回复和收藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已在我的应用程序中集成了iOS 5 Twitter。我可以通过 TWTweetComposeViewController
发送推文,并集成Twitter和Accounts框架。
I have integrated iOS 5 Twitter in my application. I am able to send tweets by TWTweetComposeViewController
with the integration of Twitter and Accounts framework.
现在我想转推在帐户框架的帮助下,在iOS 5中回复和收藏。
Now I want to retweet, reply and favorite in iOS 5 with the help of Accounts framework.
推荐答案
使用以下代码进行转发。
Use following code for retweeting.
- (void)_retweetMessage:(TwitterMessage *)message
{
NSString *retweetString = [NSString stringWithFormat:@"http://api.twitter.com/1/statuses/retweet/%@.json", message.identifier];
NSURL *retweetURL = [NSURL URLWithString:retweetString];
TWRequest *request = [[TWRequest alloc] initWithURL:retweetURL parameters:nil requestMethod:TWRequestMethodPOST];
request.account = _usedAccount;
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (responseData)
{
NSError *parseError = nil;
id json = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&parseError];
if (!json)
{
NSLog(@"Parse Error: %@", parseError);
}
else
{
NSLog(@"%@", json);
}
}
else
{
NSLog(@"Request Error: %@", [error localizedDescription]);
}
}];
}
祝你好运。
这篇关于使用Accounts框架在iOS 5 Twitter中转发,回复和收藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文