简体   繁体   中英

Should I delete old tables from Realm on iOS?

As part of an update, I retired a class that was persisted to Realm. These objects could potentially take up a lot of space on users' devices, so I don't want the old objects' data to remain in the Realm file after the migration. Will the Realm migration detect that the class is no longer in the project and do some cleanup, or do I need to explicitly delete that table? In the latter case, how do I do that?

You need to explicitly delete all of the data for the type from the Realm file during the migration. You can do so by calling Migration.deleteData(forType:) within your migration block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM