基本上我正在尝试使用 ASIFormDataRequest 上传图像。这是我的以下代码
ASIFormDataRequest *request = [ASIHTTPRequest requestWithURL:urlImg];
[request setRequestMethod:@"POST"];
[request addRequestHeader:@"Content-Type" value:@"application/xml"];
[request setDelegate:self];
[request setTimeOutSeconds:500];
NSData *imageData = UIImagePNGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"]);
[request setData:imageData forKey:@"media"];
[request startAsynchronous];
基本上我的应用程序会崩溃并给我以下错误:
[ASIHTTPRequest setData:forKey:]: unrecognized selector sent to instance 0x8880db0
2010-06-28 12:33:49.803 vdq[7658:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[ASIHTTPRequest setData:forKey:]: unrecognized selector sent to instance 0x8880db0'
不知道为什么,但 setData 方法似乎在那个实例中。