In iOS apps , what’s the difference between the main bundle and the documents directory?
original source : https://stackoverflow.com/questions/25471024/in-ios-apps-whats-the-difference-between-the-main-bundle-and-the-documents-di
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