How do I find the size of my Core Data persistent store and the free space on the file system?

前端 未结 3 2074
粉色の甜心
粉色の甜心 2020-12-13 16:33

I am working on a database application using the Core Data framework. In this application I need to display how much data the application currently is using on the iPhone. I

3条回答
  •  被撕碎了的回忆
    2020-12-13 17:18

    Not sure where I saw it, but I believe that removing entries from the database will not necessarily shrink the database file. SQLite reclaims the storage internally and re-uses it. (This is typical of RDBMSs.) I believe there's a command-line utility somewhere that will compact it, but that's not going to help you if your app wants shrink the file to the dataset (to reclaim space for the OS, for example).

    So while the file size method will give you a sense of the high-water-mark size of the database, it's not necessarily going to tell you the amount of storage used by your dataset.

提交回复
热议问题