Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. NSUInteger cacheSizeMemory = 5*1024*1024; // 5 MB
  2. NSUInteger cacheSizeDisk = 5*1024*1024; // 5 MB
  3. NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
  4. [NSURLCache setSharedURLCache:sharedCache];
  5.  
  6. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:@"com.example.apple-samplecode.SimpleBackgroundTransfer.BackgroundSession"];
  7. configuration.URLCache = [NSURLCache sharedURLCache];
  8. configuration.requestCachePolicy = NSURLRequestReturnCacheDataElseLoad;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement