Read PDF

Avoid Caching HTTP(S) Requests/Responses


By default, iOS’s NSURLRequest will cache responses in the Cache.db file. To prevent this insecure behavior, a developer must explicitly disable caching.


The developer can set the cachePolicy property of the NSURLRequest to disable the caching of HTTP(S) requests and responses. One of many methods for disabling caching is shown in the following code snippet (from NSURLConnection Delegate Returns Null on Stack Overflow -

(NSCachedURLResponse)connection:(NSURLConnection)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse { return nil;

Developers can find additional methods for disabling the caching of HTTP(S) requests and responses in the Apple Developer article “Understanding Cache Access” referenced below.



results matching ""

    No results matching ""