• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Suggested maximum size of NSCachesDirectory on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggested maximum size of NSCachesDirectory on iOS


  • Subject: Re: Suggested maximum size of NSCachesDirectory on iOS
  • From: Robert Vojta <email@hidden>
  • Date: Mon, 10 Jun 2013 08:51:24 +0200

Hi Markus,


On Sunday, 9. June 2013 at 23:13, Markus Spoettl wrote:

> on iOS, is there any documentation on how much space an app should use at
> most when storing things in the location returned by NSFileManagers's
> -URLsForDirectory: with NSCachesDirectory? Are there any hard numbers (like for
> example "never more than 1/20th of the entire disk", or something like that)? I
> couldn't find the slightest hint.

I don't think they're such rules. And things like 1/20th of the entire disk doesn't make sense either, because it's different number for 16, 32 or 64 GB device. My rules are - wisely utilize all available resources to make user happy. It's balancing on the edge … If you want to feel safer, raise your internal limits …
> I have an app that potentially produces a lot of cached data (downloaded from
> the network). Caching is highly beneficial to its performance, so generally the
> bigger the cache the better. Still, filling the device up until it's maxed out
> doesn't seem a good thing to do.

Depends on app, for how long user have to download these data, … If it's kind of magazine app, you can be nice and ask user if you can delete older issue, because download of the new issue can lower disk free space below some limit you have to choose, etc.
> Also, there's no mention on when cached files will get deleted (in case space
> runs out). The only piece of documentation with respect to deletion I came
> across is that cache files *may* not survive an update of the app. However, the
> system surely will (have to) start deleting files before then if it runs out of
> space, no?

To quote docs:

Cached data should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include (but are not limited to) database cache files and downloadable content, such as that used by magazine, newspaper, and map apps. Your app should be able to gracefully handle situations where cached data is deleted by the system to free up disk space.

There's no when, but there's that they're.

Temporary data should be stored in the <Application_Home>/tmp directory. Temporary data comprises any data that you do not need to persist for an extended period of time. Remember to delete those files when you are done with them so that they do not continue to consume space on the user's device.

Depends on data, sometimes NSTemporaryDirectory() is better. Data in temporary directory are deleted after 3 days IIRC.

Regards,
Robert
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Suggested maximum size of NSCachesDirectory on iOS
      • From: Markus Spoettl <email@hidden>
References: 
 >Suggested maximum size of NSCachesDirectory on iOS (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Search field in menu, like Help menu has
  • Next by Date: Re: Suggested maximum size of NSCachesDirectory on iOS
  • Previous by thread: Suggested maximum size of NSCachesDirectory on iOS
  • Next by thread: Re: Suggested maximum size of NSCachesDirectory on iOS
  • Index(es):
    • Date
    • Thread