How can I ship my app with a pre-populated Core Data database?

后端 未结 5 1478
天涯浪人
天涯浪人 2021-02-01 08:16

My app uses Core Data and I want some default entries to be inside. What\'s best practices of how to do that?

5条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 08:42

    I would just create a database and put add it to my target so that Xcode copies it into the app bundle. At the first launch just copy it from the app bundle to eg. the documents directory or wherever your app expects the database.

提交回复
热议问题