I'm writing an application that loads one of our websites into a UIWebView. To speed up the loading times I've created sub class of NSURLCache which checks a NSDictionary to see if the images exists locally and if so it uses the local image rather than requesting the online version. I have an issue though, some of the images have the same name, but in different folders. Here's my NSDictionary:
[NSDictionary dictionaryWithObjectsAndKeys:
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/1-Star/1-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/2-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/2-Star/2-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/3-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/3-Stars.png",
@"4-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/4-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/3-Stars.png",
@"4-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/4-Stars.png",
@"5-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/5-Stars.png",
nil];
In may app I have the images in the same folder structure as online, so how do I tell a request for 'https://www.xxx.com/content/star-bar/1-Star/1-Stars.png' to use the correct image and not the image meant for 'https://www.xxx.com/content/star-bar/2-Star/1-Stars.png'?
I hope that's clear!