在使用UIImagePickerControllerOriginalImage从UIImagePickerController获取图像时获取内存警告

我正在使用UIImagePickerController从相机获取图像。 刚刚捕捉图像,并获取它通过使用UIImagePickerControllerOriginalImage获取内存警告。 我在iOS上使用iphone 4s。

代码在这里

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissViewControllerAnimated:YES completion:nil]; UIImage* originalImage = [info objectForKey:UIImagePickerControllerOriginalImage]; //Getting memory warning after this line NSData *data =UIImageJPEGRepresentation(originalImage, 0.1); } 

我试图用很多方法来解决这个问题,但没有取得成功。 最后,我改变了我的方法,并使用AVCaptureSession从iPhone相机拍照这里是苹果提供的示例代码

https://developer.apple.com/library/ios/samplecode/SquareCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011190

现在一切都好,没有内存泄漏,性能提高了,捕获进程很快。