David Janes' Code Weblog

April 8, 2012

NSURLConnection, ETag and caching

code fragments,iphone,tips · admin · 7:40 am ·

If you’re using NSURLConnection and using If-None-Match/ETag and you’re depending on getting a 304 status to determine that “nothing changed”, make sure you do this:

[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];

If you don’t, after your first request/response cycle, NSURLConnection will start returning status 200 instead as it’s pulling the result from its local cache.

Powered by WordPress

Switch to our mobile site