Is there any way to add a photo to Twitter timeline using TWRequest or anything like so?? I'm very very lost in this case.
I can post a status update using TWRequest for iOS5 and MGTwitterEngine for previous iOS version, but I'm not able to attach a UIImage to the update.
Thanks in advance for any help provided.
With TWRequest, you can use the
-addMultipartData:withName:type:
method on that with the data from, e.g., theUIImageJPEGRepresentation()
method, to post a tweet via the Twitter API’sstatuses/update_with_media
method.If you’re using TWTweetComposeViewController, it’s even simpler: you can attach one or more UIImage images to it with the
-addImage:
method.I have found and used so many great answers on this site, Thanks everyone, thought it's about time to give back :) Elaborating on Noah's answer, this is the final code that worked for me to get an image and text on a tweet using TWRequest...
I found using TWRequest to be best solution for my scenario as I didn't want the user to be able to edit the post before tweeting (which was the issue with using TWTweetComposeViewController)
you can use the twitter compose view controller
TWTweetComposeViewController
to post photos to twitter without dealing with twitter oauth and accounts. see http://developer.apple.com/library/ios/#documentation/Twitter/Reference/TWTweetSheetViewControllerClassRef/Reference/Reference.html for more details.The main issue is it's a new feature of iOS 5, so users that didn't upgrade won't be able to use it.