views:

391

answers:

1

I was using the Twitpic API from in my iPhone app for a while with no problem, then suddenly it started reporting: invalid username or password.

I changed the URL to that of yfrog and they reported: could not find the media.

I changed the URL to that of Posterous and it works.

I've done some Googling and I can't find any problems with Twitpic or Yfrog's server, so I guess it's an artefact of my code - is there anything wrong with it?

NSURL *url = [NSURL URLWithString:@"http://posterous.com/api/uploadAndPost"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];

[request setPostValue:[tmpArray objectForKey:@"Twitter Username"] forKey:@"username"];
[request setPostValue:[tmpArray objectForKey:@"Twitter Password"] forKey:@"password"];
[request setPostValue:scrapbook.short_description forKey:@"message"];
[request setData:scrapbook.image forKey:@"media"];
NSLog(@"User: '%@', pass: '%@'", [tmpArray objectForKey:@"Twitter Username"], [tmpArray objectForKey:@"Twitter Password"]);
[request setDelegate:self];
[request startAsynchronous];

[tmpArray objectForKey:@"Twitter Username"] and [tmpArray objectForKey:@"Twitter Password"] hold my username and password respectively as NSStrings, scrapbook.short_description is an NSString and scrapbook.image is NSData.

The NSLog outputs the correct username and password.

Thank you for your time Andy

A: 

I can not see an error in your code, maybe it the issue was a rate-limit like the one from Twitter http://apiwiki.twitter.com/Rate-limiting. But so far I haven't heard of a rate-limit for the Twitpic-API.

jd291