I use asiformdatarequest framework to upload images,The code like this:
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path1=[paths objectAtIndex:0];
NSString *filename=[path1 stringByAppendingPathComponent:@"logo.png"];
NSLog(@"image path = %@",filename);
[request setFile:[NSURL URLWithString:filename] forKey:@"avatar"];
[request startSynchronous];
我的记录:
image path = /Users/tanlusheng/Library/Application Support/iPhone Simulator/5.1/Applications/5473E6FF-0D3A-48CD-8728-0219CF25BC80/Documents/logo.png
Error Domain=ASIHTTPRequestErrorDomain Code=6 "No file exists at (null)" UserInfo=0x6b4c610 {NSLocalizedDescription=No file exists at (null)}
我在我的项目中增加了一个形象。 但它为什么不能找到档案? 我坐在模拟器上。