开发者

ios create sqlite db and xcdatamodel

开发者 https://www.devze.com 2023-02-04 19:00 出处:网络
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...

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:

  1. Create a data model in the editor in xcode.
  2. Tell xcode to generate classes to represent the data model.
  3. Write your app, adding in the setup code for core data to instantiate a Managed Object Context, etc.
  4. Add the code to create and save data model objects to the managed context.

some time later ...

  1. Modify the model in xcode's editor to represent changes to you app.
  2. 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消