Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8432631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:10:49+00:00 2026-06-10T06:10:49+00:00

The option to not cache data is NSDataReadingUncached . But if I use dataWithContentsOfURL

  • 0

The option to not cache data is NSDataReadingUncached.

But if I use dataWithContentsOfURL to update the images from URLs in a UITableViewCell (one image per cell), and I look at the Activities Monitor on the Mac for the Simulator (running as iOS 5.1 simulator), then the network traffic jumps up to 12kb/s receiving rate when I scroll the table up and down continuously. When I stopped scrolling up and down, the network activities drops down to about 2kb/s receiving rate or lower. Those images are very small, like 20kb or so each, and when I scroll up and down, I only make 1 or 2 image disappear / appear, so the cache, if any, won’t need to be large at all.

So it does look like dataWithContentsOfURL does not cache data, and even when I use dataWithContentsOfURL:options:error: with options being 0 to mean no option, the network activities still jump up to about 12kb/s.

So does dataWithContentsOfURL caches data, and if not, why does dataWithContentsOfURL:options:error: has the option of not cache data?

The following is also done:

[[NSURLCache sharedURLCache] setMemoryCapacity:1024*1024*10];

in viewDidLoad but the network rate still will jump up. I think the usual recommendation is that if caching is desired, then use NSURLConnection, but for some reason, in the NSURLConnection reference on Apple’s doc, the word “cache” or “caching” doesn’t appear at all except there is mentioning of a sample project called “URLCache”, but no mentioning of caching at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:10:51+00:00Added an answer on June 10, 2026 at 6:10 am

    We’re talking about two different caches here, the file-system cache, and the network cache.

    The flag you can pass into dataWithContentsOfURL:options:error: (NSDataReadingUncached) refers to the former. It’s a hint that the data you’re reading will only be read once, so it doesn’t need to linger in the cache. You might be surprised to learn that the file-system cache is involved at all here, since we’re reading from a URL, but remember that the URL might be a file URL, in which case the read occurs from disk rather than generating a network request.

    As to the other type of cache, the network cache, you don’t have any say whether loading the contents of a URL using the NSData convenience methods uses caching or not: it doesn’t. For that behavior, you have to use a lower-level API like NSURLConnection, as you mentioned. Note that in order to take advantage of HTTP caching at this level, your server needs to send the proper headers indicating how long resources are valid. Otherwise, the request will be made under the pessimistic assumption that the resource has changed. NSURLConnection on iOS will automatically use NSURLCache under the sheets, again provided that Expires/Cache-Control headers are received.

    Sidenote: When using NSURLConnection, you set the cache policy not on the connection, but on the NSURLRequest object(s) you use to make requests with the connection. So, you’d need to look at the reference for NSURLRequest and its ilk to find out the details.

    If none of the above is suitable to you, you can roll your own cache scheme, or start with NSURLCache and use it directly. As of iOS 5, NSURLCache started using disk caching and honoring the diskCapacity property, making it even more powerful than before. This is the right way to go if you have some sort of out-of-band knowledge of how long the resources will stay fresh, above and beyond what your HTTP server is telling you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before any one suggests HTML, I explain later why thats not an option here.
Option is implicitly convertible to an Iterable - but why does it not just
SQL Server Express does not have the Tasks -> Import Data option that other
is there an option to generate sequence diagram from not running code in enterprise
Not really a question but I'm looking for comments/suggestions from anyone who has experiences
I am not sure what is wrong with my JSON response from WCF but
TTreeNode does not have a Visible property, so the obvious option does not exist.
Setting up the sandboxes for all these option is not feasible right now. So
Using the commandline visual basic compiler (vbc.exe) with option VBruntime- does not allow using
I need to know which stored procedures are running. It's not an option to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.