【发布时间】:2013-03-24 18:01:55
【问题描述】:
当启用 Guard Malloc 时,我在 UIImagePNGRepresentation() 处收到 EXC_BAD_ACCESS 错误,当我禁用时,我在转换图像时没有收到任何错误。我已经通过谷歌寻求解决方案,但我没有找到任何可行的解决方案。下面是代码。
UIImage *image, *newImage;
NSData *imageData = [NSData dataWithContentsOfFile:@"somepath"];
image = [UIImage imageWithData:imageData];
NSData* data = nil;
data = UIImagePNGRepresentation(image);
// write to temp directory and return URI
NSString* docsPath = [NSTemporaryDirectory ()stringByStandardizingPath];
// more code
这是 phonegap 插件代码的一部分,任何建议都非常有帮助。 谢谢。
【问题讨论】:
-
尝试将扩展名添加到图像名称
标签: iphone ios malloc exc-bad-access uiimagepngrepresentation