Twitpic API from iPhone - pic posted but no URL returned?

Posted by Jamie Badman on Stack Overflow See other posts from Stack Overflow or by Jamie Badman
Published on 2009-04-17T22:59:59Z Indexed on 2010/05/21 20:10 UTC
Read the original article Hit count: 768

Filed under:
|
|
|

This is a weird one...

With the help of people here, I've got my iPhone app posting to TwitPic successfully - and when I first got it working, I could see an XML result being returned too...

But for some reason over the past two days, the API call seems to succeed - the pic appears on TwitPic - but... the response seems to be empty...

Anyone have any ideas? Seen anything similar? The code I use to invoke the API call is:

    ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];

[request setData:twitpicImage forKey:@"media"];
[request setPostValue:username forKey:@"username"];
[request setPostValue:password forKey:@"password"];

// Initiate the WebService request
[request start];

// Need to find out how I can access the result from this call...

/* Result structure should be:

 <?xml version="1.0" encoding="UTF-8"?>
	<rsp stat="ok">
		<mediaid>abc123</mediaid>
		<mediaurl>http://twitpic.com/abc123</mediaurl>
	</rsp>
*/

// Check for errors
if ([[request responseHeaders] objectForKey:@"stat"] != @"ok"){
	UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"TwitPic Submission" 
													message:[[request responseHeaders] objectForKey:@"mediaurl"]
												   delegate:nil
										  cancelButtonTitle:@"OK!" 
										  otherButtonTitles:nil];
	[errorAlert show]; 
	[errorAlert release];
}

NSString *twitpicURL = [[request responseHeaders] objectForKey:@"mediaurl"];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"TwitPic Submission" 
									  message:twitpicURL
									  delegate:nil
									  cancelButtonTitle:@"OK!" 
									  otherButtonTitles:nil];

I tried just dumping out [request responseString]... that's empty now also. That WAS showing a response, for sure.

As always, any help gratefully received. I'll give back once I'm able!

Cheers,

Jamie.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about web-services