Let me start by saying that dataWithContentsOfURL:options:error: and its ilk are probably the worst APIs for getting something from the network. They are very attractive to developers because they can get a resource from the network in one line of code, but they have some very detrimental side effects:
First, they block the thread that they are invoking. This means that if you execute this in the main thread (the only thread on which your user interface can be updated), your application will be frozen for the user. This is really a big no from the point of view of users.
Secondly, you cannot cancel these requests, therefore, even if you put this request in the background thread, it will continue to load, even if the data can be more useful. For example, if your user comes to the viewing controller, and you execute this request, and subsequently the user decides to click the "Back" button, this data will continue to be downloaded, although this is no longer relevant.
Bottom line: DON'T USE THESE API API .
Use an asynchronous network, such as NSURLConnection or AFNetworking . These classes were designed to collect data efficiently and in a way that does not interfere with user experience. What's even better is that they handle the specific use case that you originally asked: how do I stop caching on disk? .
source share