I have a iphone application in which I use nsecoding for saving my objects. However it has been decided that it should be saved using core data.
我有一个iphone应用程序,我在其中使用nsecoding来保存我的对象。但是已经决定使用核心数据来保存它。
The questions is - what is the best way to convert my exsisting model classes to datacore classes. Should I create a new thorugh the xdatamodel editor and replace the old or what is the best strategy. I have not figure out an easy way to do this :P
问题是 - 将我现有的模型类转换为数据库类的最佳方法是什么。我应该创建一个新的xdatamodel编辑器并替换旧的或什么是最好的策略。我还没有找到一个简单的方法来做到这一点:P
Regards
Bjarke
1 个解决方案
#1
1
Roughly, what you will need to do is this:
粗略地说,你需要做的是:
Create a data model that reflects the classes that you have already created - and I think you'll have to do it by hand in the model editor.
创建一个反映您已经创建的类的数据模型 - 我认为您必须在模型编辑器中手动完成。
Then change your classes so they become subclasses of NSManagedObject. You'll have to make sure your properties are restricted to types handled by Core Data, of course.
然后更改您的类,使它们成为NSManagedObject的子类。当然,您必须确保您的属性仅限于Core Data处理的类型。
#1
1
Roughly, what you will need to do is this:
粗略地说,你需要做的是:
Create a data model that reflects the classes that you have already created - and I think you'll have to do it by hand in the model editor.
创建一个反映您已经创建的类的数据模型 - 我认为您必须在模型编辑器中手动完成。
Then change your classes so they become subclasses of NSManagedObject. You'll have to make sure your properties are restricted to types handled by Core Data, of course.
然后更改您的类,使它们成为NSManagedObject的子类。当然,您必须确保您的属性仅限于Core Data处理的类型。