Quote:
Originally Posted by Howell
Does anyone know how load data into Core Data easily? Preferably from a file that can be edited easily like a .CSV file or whatever else. Or should I be going about this another way?
Thanks!
|
Here is what I have done for my app.
1) Create the model in XCode (it is essential do this first, because XCode uses a specific naming convention and adds several underlying tables to the actual data model.
2) Run the application in the Simulator and with the app running ... go and copy the database (/users/library/Application Support/iPhone Simulator/User/Applications/<app name> to some other location
3) Open up the database (I use SQLite Manager plugin in Firefox)
4) From here I import my data from a CSV file once I have updated all of my CSV column names to match the table names
5) Look at the CoreDataRecipies sample code for including a pre-populated database (code is in the Delegate.m file)
6) Import the database in your application and you should be good to go.