I am having trouble sending a reply to a tweet using TWRequest
api. I am able to post a new tweet/status successfully but replies are failing with error below. Please advise
The error I receive on the reply post is:
Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed.
(NSURLErrorDomain error -1012.)" UserInfo=0x6c67900 {NSErrorFailingURLKey=https://api.twitter.com/1/statuses/update.json, NSErrorFailingURLStringKey=https://api.twitter.com/1/statuses/update.json,
NSUnderlyingError=0x6ce28a0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"}
Sample code below:
NSDictionary *paramDict = nil;
if(isReply)
{
paramDict = [NSDictionary dictionaryWithObjectsAndKeys:
in_reply_to_status_id, @"in_reply_to_status_id",
status, @"status",
nil];
NSLog(@"Status is %@ %@",status,in_reply_to_status_id);
}
else
{
paramDict = [NSDictionary dictionaryWithObject:status forKey:@"status"];
}
TWRequest *sendTweet = [[TWRequest alloc]
initWithURL:[NSURL URLWithString:@"https://api.twitter.com/1/statuses/update.json"]
parameters:paramDict
requestMethod:TWRequestMethodPOST];
sendTweet.account = self.account;
[sendTweet performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse,
NSError *error) {
if ([urlResponse statusCode] == 200) {
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"Sent tweet: %@", status);
});
}
else {
NSLog(@"Problem sending tweet: %@", error);
}
}];
Stop looking for any help with TWRequest Twitter.framework is deprecated with iOS 6.0 For any references do visit the dev.twitter.com
Use Social.Framework if you only need to post tweet or Images with tweet you can use SLComposeViewController for that purpose.
In Other Cases like replying to a tweet or favorite or even embedding Try this Singleton Class: https://github.com/fhsjaagshs/FHSTwitterEngine Read it's description do launch the demo and YOUR all set