Core Data “Upsert” from SQLite Database

后端 未结 2 1801
孤城傲影
孤城傲影 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 10:51

    Where is the original database coming from?

    Typically, you would convert all your data to Core Data during development and then ship the app with a pre-populated Core Data store (no need for a user to wait for an import).

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题