开发者

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.


I also found this very helpful: http://ablogontech.wordpress.com/2009/07/13/using-a-pre-populated-sqlite-database-with-core-data-on-iphone-os-3-0/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜