I'm making application using VK iOS SDK (russian social network). I'm sending request for getting some data from wall. I want to caching that data, but I don't really understand what should I do next. In AppDelegate I'm make:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024
diskCapacity:20 * 1024 * 1024
diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
return YES;
}
NSURLCache working in background, right? (kind of)
What next? I want to use NSURLRequestReturnCacheDataElseLoad
. If I'm understand this right, it means: if I have cache, I'll use cache. But if it's not, I'll send request.
If I'm wrong, please correct me, where. I would be grateful.