View Full Version : Prefilling Core Data

Oct 27, 2009, 11:29 AM
I've been following Core Data, Part 5: Prefilling Data (http://iphoneinaction.manning.com/iphone_in_action/2009/09/core-data-part-5-prefilling-data.html) but I feel like there's something missing.

If you're not familiar, it's basically telling me to create another program that's a db filler with the same xcdatamodel, and use a csv file to fill it up. Then I'm supposed to copy the .sqllite file I created to my original project.

It suggests changing the
NSURL *storeUrl = [NSURL fileURLWithPath:
[[self applicationDocumentsDirectory]
stringByAppendingPathComponent: @"Money.sqlite"]];
in the prefilling program to match the sqlite file that my 'real' product should have.

So I let it run in simulator and get a .sqlite file in the ~/Library/Application Support/iPhone Simulator/User/Applications/{appid}/Library

and put it in my "real" project bundle, but it's not reading the file from the bundle. I have a feeling I'm missing something here, like having to copy over that .sqlite file to my new application directory by code or something. Does anyone have any suggestions?