iPhone app launch times and Core Data migration

后端 未结 5 1662
有刺的猬
有刺的猬 2021-02-02 01:51

I have a Core Data application which I plan to update with a new schema. The lightweight migration seems to work, but it takes time proportional to the amount of data in the dat

5条回答
  •  你的背包
    2021-02-02 02:15

    You might put your Core Data updates into an NSOperation, which can be added to an operations queue in didFinishLaunching... and which can operate in the background, by overriding the operation's -main method.

    Take a look at this tutorial page to get a general idea of what's involved. Use KVO with the operation's isFinished property to update the state of your application -- you might use this key's value to warn the user that the migration is still taking place, for example, before presenting any data.

提交回复
热议问题