I’m trying to use MKNetworkEngine but the headers talk about caching. This is totally bad for my app which needs to download currency exchange rate JSON files and caching is a no-go.
Is there a way to turn caching off for the whole MKNetworkEngine instance?
First things first: Are you really sure about your caching use case? Most of those stock providing web services set their Cache-Pragma/ETags headers to a reasonable value. If they do so, MKNetworkKit will do the right thing and will only respond to your code with a cache hit, if this is valid for your request.
Nontheless you can control the utilization of the cache via two methods. Right from MKNetworkEngine.h:
Calling
enqeueOperation:forceReload:with forceReload set toYESwill do the trick. Like so:Further more you can empty the cache explicitly (beware that means emptying the cache for all your requests) with a call to
[self emptyCache]just before[self enqueueOperation:op]inside of yourMKNetworkEnginesubclass.