Core Data “Upsert” from SQLite Database

后端 未结 2 1800
孤城傲影
孤城傲影 2021-01-07 10:29

I am currently writing an App that needs the ability to modify and persist various pieces of data. I\'ve decided to use Core Data for this purpose. When the user opens the

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-07 11:13

    Apple has some suggestions on how to optimize large imports into a Core Data store:

    • Disable the undo-manager during batch import
    • Don't insert record-by-record - Create batches of size n (depending on record size)
    • Use a local autorelease pool and drain it after each batch

    See the documentation for the details.

提交回复
热议问题