ios create sqlite db and xcdatamodel
I wish use nsmanagedobject to use a sqlite database into my project.. I downloaded CoreDataBooks sample but there's something that I don't understand right...
for example... where is the link between the tables and xcdatamodel? i tried to change the sqlitedb with my db and ch开发者_如何学Goange xcdatamodel but doesn't work
can you help me? thanks
Hmm, the way it works is this:
- Create a data model in the editor in xcode.
- Tell xcode to generate classes to represent the data model.
- Write your app, adding in the setup code for core data to instantiate a Managed Object Context, etc.
- Add the code to create and save data model objects to the managed context.
some time later ...
- Modify the model in xcode's editor to represent changes to you app.
- Regenerate associated model classes.
From your description it sounds like you are trying to edit the database directly and manage the classes that represent it yourself. I suspect this is possible, but using xcode's tools is easier and everything its taken care of for you.
Does that help?
精彩评论