How do you compact a Realm DB on iOS?

前端 未结 3 1552
粉色の甜心
粉色の甜心 2021-02-08 19:46

I\'d like to compact a Realm instance on iOS periodically to recover space. I think the process is to copy the db to a temporary location, then copy it back and use the new defa

3条回答
  •  你的背包
    2021-02-08 20:07

    Well.. it appears as though this issue is mostly obsolete. Realm added an automatic compact feature last fall. Realm Docs / compacting-realms. I think the only reason to do it as described by @marius is if you need to control the user experience and compact in the background.

    See this question for more: How to correctly use shouldCompactOnLaunch in RealmSwift

提交回复
热议问题