已把图片保存,读取的时候也有路径,为什么读不到图片?
//存图片
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
//获取沙盒路径
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
[imageData writeToFile:fullPath atomically:NO];
//读取图片
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Docments"] stringByAppendingPathComponent:@"currentImage.png"];
UIImage *savedImage = [[UIImage alloc] initWithContentsOfFile:fullPath];
结果savedImage是空的。
兄弟 你少写了个u;
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Docments"] stringByAppendingPathComponent:@"currentImage.png"];
是documents 不是docments