I want to upload an image to my twitter profile using objective-c. I saw in the twitter API that I need to send a HTML post to http://twitter.com/account/update_profile_image.format and send the picture as a parameter. I am done with the authentication. I am stuck with the uploading. Maybe somebody can help me with sending the picture as a parameter?
I want to upload an image to my twitter profile using objective-c. I saw
Share
You should be using
NSURLRequestsandNSURLConnectionto perform the API requests. If this is true, all you need to do is create anNSMutableURLRequest, set it’s URL to the Twitter image upload API URL, set the method to POST.Then you’ll need to create an NSData object to represent your image, which you can do using
I don’t know what the parameter name is for Twitter’s upload API, so for arguments sake, lets call it “image”. The next thing you need to do is set the image data as the request’s body for the “image” parameter, like this
Then you can just start your NSURLConnection with the request and it should upload.