Question

I am having about 60 different images coming from the webservice.And I am storing it in a NSMutablearray.

now when I load the image for the very first time , each image will consume about 0.5 to 1.5 mb of space of iPad. As I do have multiple images the memory consumption reaches very high and then application gets crashed.

I am showing image in an image view by clicking on a button.

Can any one suggest me how to menage such an memory issue so that application will not be crashed.

thanks in advance.

Was it helpful?

Solution

I would store the image to the apps cache & then read them back from the cache when you need them.

NSString *cachesDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];    
NSLog(@"cachesDirectoryPath: %@", cachesDirectoryPath);

or save yourself the heartache & use ASIHTTPRequest - http://allseeing-i.com/ASIHTTPRequest/

& get a bit more than just caching thrown in.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top