Attempting to Pre-load Data into Core Data Store
Sup fellas, I am using the script that a fellow stack overflow user posted here(the post by kalperin) to pre-load data to an SQL Lite store. So I have a command-line utility project that I am using and I have an iPhone application in which I successfully parsed my .plist file and stored it in Core Data, and I am trying to copy over code from my iPhone application to this command-line utility(the plist parsing parts at least). The data model I have ma开发者_开发百科de looks like so:
Those two classes inherit from ParkingRegionOverlay which requires the MapKit framework which is not addable to a project of this type(as far as I know). So my questions:
- How would I bypass this problem(i.e. How do I get the Mapkit framework as part of my command-line utility project?)?
- Do I need to include my .xcdatamodel file in the command-line utility project and reference it in any way? If someone wouldn't mind shedding some light in this area it would be greatly appreciated, as I think I do need my project to know about the data model, but am not quite sure.
Thanks in advance for any help!
you absolutely need the xdatamodel file in your project. It will be "compiled" into a momd file and included in your application bundle. Core Data needs this to know what your data model looks like (that's the whole point of the data model file).
This might help you, too: Can't find momd file: Core Data problems
Also, why do you mix Model and View by having your data model classes inherit from an Overlay class. It seems that you can solve your problem simply by adhering to MVC practices.
Cheers,
Johannes
精彩评论