简体   繁体   中英

shipping the core-data data with the app

I noticed that when you run the app on the simulator, the data is saved in an sqlite file located at " /Users/tristan/Library/Application Support/iPhone Simulator/4.2/Applications/{app id}/Documents/ ", but when you build&archive the app, that same file doesn't appear to be included in the archive. Installing the app directly to the phone starts a new core data database.

I'd like to ship the app with a sqlite file that I've already filled with information. Does anyone have any recommendations of how to go about doing this?

Include your sqlite file in the app bundle. When app is first launched (or whenever it's launched, if that makes more sense) check to see if sqlite file is in Documents directory. If not, copy from bundle to directory.

Here's SO link for detecting first launch .

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