1
-(IBAction)btnPostclick
{NSURL *url = [NSURL     URLWithString:@"http://yfrog.com/api/uploadAndPost"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setDelegate:self];
if (IMG)
{
if([galleryImageView.image description] == NULL)
{
[request setData:UIImageJPEGRepresentation([UIImage imageNamed:@"logo.png"], 0.8)     forKey:@"media"];
}
else
{
[request setData:UIImageJPEGRepresentation(galleryImageView.image, 0.8) forKey:@"media"];
}
}
else
{
[request setData:UIImageJPEGRepresentation([UIImage imageNamed:@"logo.png"], 0.8) forKey:@"media"];            
}        
[request setPostValue:userdata.twitterUserName forKey:@"username"];
[request setPostValue:userdata.twitterPassword forKey:@"password"];
[request setPostValue:comm forKey:@"message"];
[request startAsynchronous];        
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestFailed:)];}

我正在使用 yfrog API 来分享图片和推文。

我使用ASIFormDataRequest. 我已在请求中设置了我的 Twitter 用户名和密码。请求被异步调用。

当响应到达时-(void)requestDone:(ASIHTTPRequest *)request,方法会自动调用。我得到了成功的回应

-(void)requestDone:(ASIHTTPRequest *)request
{
NSString *response = [request responseString];
NSLog(@"Response -> %@",response);
}

但它不会在我的推特账户上发送推文。任何人都可以解决这个问题吗?

应用程序的基本 SDK 是:iOS 4.3

应用程序的部署目标是:3.1.3

提前致谢。

4

0 回答 0