Jelle
Jelle

Reputation: 294

Problem with image caching

I have an iPhone app with a UITableView. I'm download images from internet and put them in the TableViewcell. First I cache the images and then I load them into the TableView. On the first sight, it looks like the images cached well and are loaded fine in the tableview. But when I scroll the TableView, the app crashes and I get an error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 isFileURL]: unrecognized selector sent to instance 0x6e4d800'

I used this tutorial/example to cache the images: http://www.makebetterthings.com/blogs/iphone/image-caching-in-iphone-sdk/

Does anyone know what's going wrong and what I have to do to solve this problem?

Thanks,

Jelle

Upvotes: 2

Views: 616

Answers (1)

deanWombourne
deanWombourne

Reputation: 38485

You're calling a method on an NSString that doesn't exist (the method is isFileURL). The method exists on NSURL so I guess the solution is something like this :

// Turn the string into a url
NSString *myPath = @"/cache/image1.png";
NSURL *myURL = [NSURL fileURLWithPath:myPath];

// This line would previously have crashed
BOOL isFile = [myURL isFileURL];

The other possibility is that you think you are using an NSURL but you forgot to retain it :)

Upvotes: 3

Related Questions