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 プラグイン コードの一部であり、提案は非常に役立ちます。ありがとう。