First time loading remote images into an iPhone app, and would like some help optimizing the process. What I\'ve currently done is get the image if it doesn\'t exist, and ca
2 suggestions: 1. Don't store images in NSUserDefaults, that is more suitable for user preferences, like strings.
Replace this:
if ([NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"Settings_SFCCovers%@_%@", retina, cell.cid]]]) {
thumb = [NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"Settings_SFCCovers%@_%@", retina, cell.cid]]];
With this:
thumb = [NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"Settings_SFCCovers%@_%@", retina, cell.cid]]];
if ( thumb ) ...
Just having a quick look at your code - you seem to be pushing blocks onto asynchronous queues, but you are calling UI code in those blocks.
You should only run UI code on the main thread.
As for a solution - have a look at some of the open source implementations to either give you an idea of what you should be doing, or just use them directly.
One such is AsyncImageView on Github.
There are others that a quick search will bring up.