Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 843997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:13:10+00:00 2026-05-15T06:13:10+00:00

I have been working on an iPhone app that has a feature of uploading

  • 0

I have been working on an iPhone app that has a feature of uploading photos to TwitPic. I have it working with basic authentication.

I am trying to get it working with OAuth. I am getting authentication errors. I have studied very carefully the TwitPic documentation.

I am authorising the app by displaying a UI Web View and the it returns a PIN value. I enter the PIN value in the app and request the token.

I am able to upload status updates to Twitter but not photos.

My code is based on some example code from here:

Example iPhone app using OAuth

Here is my code:

NSString *url = @"http://api.twitpic.com/2/upload.json";
NSString *oauth_header = [oAuth oAuthHeaderForMethod:@"POST" andUrl:url andParams:nil];

NSLog(@"OAuth header : %@\n\n", oauth_header);

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
[request addRequestHeader:@"User-Agent" value:@"ASIHTTPRequest"];
request.requestMethod = @"POST";

[request addRequestHeader:@"X-Auth-Service-Provider" value:@"https://api.twitter.com/1/account/verify_credentials.json"];   

[request addRequestHeader:@"X-Verify-Credentials-Authorization" value:oauth_header];    

NSData *imageRepresentation = UIImageJPEGRepresentation(imageToUpload, 0.8);        
[request setData:imageRepresentation forKey:@"media"];
[request setPostValue:@"Some Message"  forKey:@"message"];  
[request setPostValue:TWITPIC_API_KEY  forKey:@"key"];  

[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestFailed:)];

[request start];    

Here is the OAuth Header:

OAuth realm="http://api.twitter.com/", oauth_timestamp="1275492425", oauth_nonce="b686f20a18ba6763ac52b689b2ac0c421a9e4013", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="zNbW3Xi3MuS7i9cpz6fw", oauth_version="1.0", oauth_token="147275699-jmrjpwk3B6mO2FX2BCc9Ci9CRBbBKYW1bOni2MYs", oauth_signature="d17HImz6VgygZgbcp845CD2qNnI%3D"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:13:10+00:00Added an answer on May 15, 2026 at 6:13 am

    HA! I found it!
    We should create the header with https://api.twitter.com/1/account/verify_credentials.json and post to http://api.twitpic.com/2/upload.json! (And use GET)

        NSString *fakeurl = @"https://api.twitter.com/1/account/verify_credentials.json";
    NSString *oauth_header = [oAuth oAuthHeaderForMethod:@"GET" andUrl:fakeurl andParams:nil];
    
    NSLog(@"OAuth header : %@\n\n", oauth_header);
    
    NSString *url = @"http://api.twitpic.com/2/upload.json";
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
    request.delegate = self;
    [request addRequestHeader:@"User-Agent" value:@"ASIHTTPRequest"];
    request.requestMethod = @"GET";
    
    [request addRequestHeader:@"X-Verify-Credentials-Authorization" value:oauth_header];    
    [request addRequestHeader:@"X-Auth-Service-Provider" value:@"https://api.twitter.com/1/account/verify_credentials.json"];   
    
    
    NSData *imageRepresentation = UIImageJPEGRepresentation([UIImage imageNamed:@"IMG_0717.jpg"], 0.2);    
    if (imageRepresentation) {
        NSLog(@"Pic not nil");
    }
    [request setData:imageRepresentation forKey:@"media"];
    [request setPostValue:@"twitpic, i hate you. die painfully."  forKey:@"message"];  
    [request setPostValue:twitPicKey  forKey:@"key"];  
    
    [request setDelegate:self];
    [request setDidFinishSelector:@selector(requestDone:)];
    [request setDidFailSelector:@selector(requestFailed:)];
    
    [request start];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on my first iPhone app and have been able to get most
I have been working on an object class for my iPhone app that lazy
I have put one global tabBarController in iphone app that I have been working
I have an app that has been running fine on the iPhone simulator for
Greetings! I have a working iPhone app (huzzah!) that uses a MainView.xib containing a
I have been working on an iPhone App for a couple of weeks now
I have an app that is has been released and is in the app
For the past few weeks I have been working on an app that uses
I am currently working on an iPhone app that will have a user log
I have a little app that has been under development for some time. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.