当启用Guard Malloc时,UIImagePNGRepresentation出现EXC_BAD_ACCESS错误

4

当启用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 插件代码的一部分,欢迎提出任何建议。谢谢。


尝试将扩展名添加到图像名称中。 - Lithu T.V
1个回答

0

信息不足。但我可以给你一个提示,某些委托或属性已被释放。将其定义为强引用。

如果您能提供堆栈跟踪,将更有帮助。

祝好运


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接