我写了这么个方法用来发送图片。怎么看也没错啊。打印TTURLRequest的日志出来看,显示数据已经发出去了。
可是服务器返回的提示就说图片文件为空,这是为什么呀?
+ (void)doAsynchronousRequestPost:(NSString *)url
File:(NSDictionary *)file
Delegate:(id)delegate
WithInfo:(NSDictionary *)info {
TTURLRequest *request = [self requestPost:url Delegate:delegate];
request.response = [[[TTURLJSONResponse alloc] init] autorelease];
if (nil != info) {
[request setUserInfo:info];
}
if (nil != file) {
NSData *imageData = UIImageJPEGRepresentation([file objectForKey:@"data"], 0.7f);
[request addFile:imageData mimeType:[file objectForKey:@"type"] fileName:[file objectForKey:@"key"]];
} else {
return;
}
[request send];
}