Populating core data in the App

10 views
Skip to first unread message

M. S. Hrishikesh

unread,
Apr 7, 2012, 11:58:21 AM4/7/12
to cocoa-...@googlegroups.com
Hello

I want some core data information to be populated in my App. Currently I just store the data in a text file and then populate core data when a button is pressed. But when I ship the app I would like the data to be already populated (and not ship the text file etc)

How can I copy the core data information into the user directory in the app that finally submit?

Thanks

Cyril Godefroy

unread,
Apr 7, 2012, 12:20:27 PM4/7/12
to cocoa-...@googlegroups.com, cocoa-...@googlegroups.com
Save the sqlite file created by CD. then copy it from your bundle to the appropriate location when launching the app. Remember to check for the existence of the file before copying. 

http://321run.com
Sent from my new iPad

Dan Grassi

unread,
Apr 7, 2012, 1:35:51 PM4/7/12
to cocoa-...@googlegroups.com

On Apr 7, 2012, at 12:20 PM, Cyril Godefroy wrote:

Save the sqlite file created by CD. then copy it from your bundle to the appropriate location when launching the app. Remember to check for the existence of the file before copying. 

When I did this years ago I found that I had to change the extension of the Coredata file, I changes it to .bin. Otherwise the compile/package step modified the file's contents. Note, this may no longer be necessary.

TO create the pre-populated Coredata file consider using the app itself with a separate target to pre-populate it.
Reply all
Reply to author
Forward
0 new messages