cccicl
cccicl
发布于 3个月前

<Error>: ImageIO: CGImageReadCreateDataWithMappedFile...error = 2 (No such file or directory)

BUG出现描述

: ImageIO: CGImageReadCreateDataWithMappedFile 'open' failed '路径'

error = 2 (No such file or directory)

[BUG原因]

原因:保存时,图片已被删除

解决方案:从路径读取图片后,先转换成NSData,再生成一张新的image.

UIImage*tempImage = [[UIImagealloc]initWithContentsOfFile:path];
NSData*tempData = UIImageJPEGRepresentation(tempImage,1.0);
UIImage*newImage = [UIImageimageWithData:coverData];
©2020 edoou.com   京ICP备16001874号-3