Menu
  • HOME
  • TAGS

Does the network link conditioner affect NSURLCache's response time?

ios,nsurlrequest,nsurlcache

No. If you notice any slowdown that means something has been downloaded again from server, or at least there was conditional get request that checked if cached object is different on server....

AFNetworking 2.0 AFHTTPRequestOperationManager CachePolicy not working

ios,afnetworking,nsurlcache

This is a bug in the latest version of AFNetworking, discussed in issue #2563. On January 24th, an attempt to resolve some other issue, this bug was introduced. To resolve it, either roll back to a previous version of AFNetworking 2.5.0; or manually post the KVO notifications yourself: [self.requestSerializer willChangeValueForKey:@"cachePolicy"];...

NSURLCache and Data Protection

ios,nsurlcache,data-protection

The default NSURLCache does not support changing the protection level of its store. I've solved my issue by creating a custom NSURLCache subclass that stores URL responses in a custom SQLite database with file protection set to NSFileProtectionComplete. This seems to be the only solution next to disabling URL caching.

How to clear cache of app in objective C?

ios,objective-c,caching,nsurlcache

Rather than go low-level and mess with NSURLCache, you can use your library's own high-level mechanics: [[Digits sharedInstance] logOut] ...

Does NSURLCache really require initialization as this article indicates?

ios,objective-c,cocoa-touch,nsurlsession,nsurlcache

No. The [NSURLCache sharedURLCache] is set up by iOS. I just ran through the debugger and found that the initial memoryCapacity is 512,000 bytes and the initial diskCapacity is 10,000,000 bytes (for iOS 7.1). The NSHipster article you referenced does seem to imply that you must first initialize the shared...

UIImageView+AFNetworking Managing Caching & Allocations

uitableview,uiimageview,afnetworking,nsurlcache,image-caching

You really shouldn't worry about clearing image cache as AFNetworking handle this for you automatically. It stores images internally in NSCache that as the docs say : incorporates various auto-removal policies, which ensure that it does not use too much of the system’s memory. The system automatically carries out these...

NSURLCache not working with NSURLSession

ios,swift,nsurlsession,nsurlcache

NSURLCache and NSURLSession currently appear to be buggy at best, and possibly broken. I don't need background downloads or anything like that, so I opted to use Cash: https://github.com/nnoble/Cash . It works perfectly for my needs.

Would a file with a response header `Cache-Control:Private` be prevented from being cached in a NSURLCache?

ios,caching,uiwebview,nsurlcache

I ended up creating a method similar to the NSURLConnectionDelegate method willCacheResponse, and replacing the Cache-Control:private header. willCacheResponse method func willCacheResponse(cachedResponse: NSCachedURLResponse) -> NSCachedURLResponse? { let response = cachedResponse.response let HTTPresponse: NSHTTPURLResponse = response as NSHTTPURLResponse let headers: NSDictionary = HTTPresponse.allHeaderFields var modifiedHeaders: NSMutableDictionary = headers.mutableCopy() as NSMutableDictionary modifiedHeaders["Cache-Control"] =...

Setting NSURLRequestCachePolicy and NSURLSession

ios,nsurlsession,nsurlcache

Problem 1: I think my understanding of the NSURLRequestReturnCacheDataElseLoad was incorrect. In this case the response is not cached. Problem 2: From Apple header for NSURLSession in the NSURLSessionAsynchronousConvenience category: data task convenience methods...create tasks that bypass the normal delegate calls for response and data delivery, and provide a simple...

Alamofire - NSURLCache is not working?

swift,nsurlcache,alamofire

I ended up manually adding Cache-Control as private in the header of my request and it now works. Don't even need to manually check the cache, Alamofire does it for you let cachePolicy: NSURLRequestCachePolicy = isReachable() ? .ReloadIgnoringLocalCacheData : .ReturnCacheDataElseLoad var request = NSMutableURLRequest(URL: NSURL(string: "\(baseUrl!)\(path)")!, cachePolicy: cachePolicy, timeoutInterval: timeout)...

NSURLCache - Disk caching for GET request with parameters not working

ios,objective-c,nsmutableurlrequest,nsurlcache

Finally I overrided NSURLCache to be able to achieve what I was looking for: GET requests (with parameters) being cached to Disk Requests going to cache while "Cache-Control max-age" value says it is not expired, and going to the server again after expiration, storing the new response and starting the...

NSURLConnection is growing in instruments, is this NSURLCache?

ios,nsurlconnection,instruments,didreceivememorywarning,nsurlcache

First, 400 network requests in one minute seems pretty excessive. Some of those requests are probably duplicated or unnecessary. The amount of calls is obviously downloading a lot of information, and not giving the os much time to cleanup. Second, your NSURLCache is actually providing more memory space than the...