Retweet, reply and favorite in iOS 5 Twitter with the Accounts framework

ios, ios5, iphone, objective-c, twitter

Solution

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

Taken From Here

Good Luck.

Problem

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. Now I want to retweet, reply and favorite in iOS 5 with the help of Accounts framework.

Original source