Hi all,
Ive been struggling with this for a couple of days now and after scouring the internet I still havent got it working. I have a csv file, from which I need to populate an sqlite db to use with core data.
I thought I had found a solution here http://ablogontech.wordpress.com/2009/07/13/using-a-pre-populated-sqlite-database-with-core-data-on-iphone-os-3-0/ but I cannot for the life of me get it to work. Here are the steps I have taken.
- Created a new Core Data project and generated the model and Managed Object classes;
- Performed a fetch request in vdl of rootViewController (Im not sure why this is neccessary but apparantly it is?)
- Copied the xxx.sqlite from the documents directory of my app into another directory.
- Executed the following sqlite commands from the terminal:
sqlite3 xxx sqlite> .mode csv yyy sqlite> .import yyy.csv yyy
Now when it comes to importing the csv data into my table I get a no such table error! Also when i execute a .tables command I get Z before my table name? I have imported data from a csv into a table this way before but not using a core data generated db and I think this is where the problem lies. Does anyone know where Im going wrong or of a better solution to my problem. Please let me know as Im going crazy with this..
Many thanks
Jules