tags:

views:

61

answers:

1

Hello,

I am Storing the Image taken from UIImagePickerController and saving in the Directory like:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                     NSUserDomainMask, YES);
NSString *path = [NSString stringWithFormat:@"%@/%@",
                  [paths objectAtIndex:0], 1.jpg];
[imgData writeToFile:path atomically:YES];

When iam Retrieving the image from the path and display in TableView it work for 1 or 2 times then application crash and error occurs is "memory urgent" also used code for retrieving image in UIIMageView like [UIImage imageWithContentsOfFile:path] but not working help. so How to handle the image caching?

A: 

It sounds like you're just running out of memory, and probably not in the code you've shared.

Image files are memory-hungry, especially if they are larger than the resolution of the screen.

Read all about UIImagePickerController, UIImage, Memory and More! for more detail about the memory cost of images and ways to work around that.

Tyler