Getting a memory warning when using UIImagePickerControllerOriginalImage to get an image from UIImagePickerController

I use UIImagePickerController to get the image from the camera. Immediately after I captured the image and get it using UIImagePickerControllerOriginalImage, getting a memory warning. I am using iphone 4s with iOS.

Code here

- (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);


}
+4
source share
1 answer

I tried to solve this problem in different ways, but did not succeed. Finally, I changed my approach and used AVCaptureSession to shoot from an iPhone camera. Here is an example code provided by Apple

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

, , , .

+2

All Articles