Is there a way to populate data via xcode?
I want to input data into a sqlite database so that core data can read from the file but I was wandering if ther开发者_如何学Goe's a way of populating the sqlite data via xcode or do I have to spend lots of money on an sql manager of some kind like RazorSQL to do it?
I suppose you could do the following:
Create a CoreData-based project that uses the same data-model that you're going to use for your project. To be clear, make it a Mac project and not an iPhone project. Make sure that the project is using an SQLite store, and not something like XML or binary.
In Interface Builder, add a built-in CoreData Entity editor to your view and configure it to hook up with your model (most of this should be automatic!). Then, build and run this application, and you should be able to add as much data as you like. When you are done, simply find out where the persistent store was kept (usually somewhere like ~/Library/Application Support/MyAppName/
) and copy that file for later use.
Then, you should be able to use that .sqlite
file in any app that is made to work with the same data model. Good luck, and let me know how it goes!
精彩评论