简体   繁体   English

如何在iOS中向框架添加核心数据类

[英]How to add core data classes to a framework in iOS

I am trying to create a framework out of my existing codebase for the purpose of reuse. 我正在尝试从现有代码库中创建一个框架,以实现重用。 I have a exmaple.xcdatamodeld class which in turn contains some core data classes. 我有一个exmaple.xcdatamodeld类,该类又包含一些核心数据类。 I have added this entire exmaple.xcdatamodeld class into my new framework. 我已将整个exmaple.xcdatamodeld类添加到新框架中。 But i am getting an error which says that some of the classes in my exmaple.xcdatamodeld are missing. 但是我遇到一个错误,它表示我的exmaple.xcdatamodeld中的某些类丢失了。 (Example: classname.h file not found ). (例如: classname.h file not found )。 Am i doing something wrong while adding the entire core data class? 添加整个核心数据类时,我做错什么了吗? Can anyone help me out with my problem... 谁能帮我解决我的问题...

I have taken this link as a reference while creating the framework 创建框架时,我已将此链接作为参考

edit : I am not getting the option of adding all the core data classes individually. 编辑:我不能选择单独添加所有核心数据类。 It seems i can add only the complete datamodel file. 看来我只能添加完整的数据模型文件。 PLease refer the screenshot below. 请参考下面的屏幕截图。 在此处输入图片说明

exmaple.xcdatamodeld is your data model. exmaple.xcdatamodeld是您的数据模型。 If it refers to any classes that you've created (which will be subclasses of NSManagedObject), you'll need to include the source files (.h/.m files) for those classes in your framework. 如果它引用您创建的任何类(将是NSManagedObject的子类),则需要在框架中包括这些类的源文件(.h / .m文件)。

The .xcdatamodeld file is just the model, a serialized version of the NSManagedObjectModel . .xcdatamodeld文件只是模型,是NSManagedObjectModel的序列化版本。 It does not contain any classes. 它不包含任何类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM