In iOS apps , what's the difference between th

2020-07-27 05:42发布

问题:

Can someone please explain it to me?

I want to know the difference between them regarding things like:

  • The amount of space taken from the device (wether the the app is active or terminated).
  • Memory usage.
  • The ability to read and write data (on the user's end).
  • What stays and what gets removed (or changed) when the app is: Updated form the Appstore/ Deleted.

And any other details you may find necessary.

回答1:

the mainBundle is the installed app

  • it is the size of the extracted ipa (you can see that in xcode beforehand)
  • it is ReadOnly and won't contain user files (e.g. documents)
  • deleted with your app (it is the app)
  • when updating from the App Store, older ioses replace the whole bundle, downloading it as a whole. newer oses 6+ IIRC, do delta updates, only downloading changed files. you can't say how much is downloaded -- at least the amount of bytes you changed.

the documents dir is where your user generated contents are stored.

  • Its size depends on what your user/your app creates as documents ;) it starts with 0 mb
  • It is ReadWrite
  • deleted with your app
  • remains untouched by updates

that answers question 1 and 3 and 4

question 2 is wrong .. a filesystem folder doesn't consume memory unless files are loaded by the app/the os

  • the os obviously loads the necessary parts of your app and the required frameworks
  • your app can load documents.

memory usage is only vaguely / not really related to file size



标签: ios file