gpt4 book ai didi

ios - 无法创建托管对象的子类

转载 作者:行者123 更新时间:2023-12-01 18:42:48 30 4
gpt4 key购买 nike

来自 documentation (What's New In Core Data)

Xcode automatic subclass generation Xcode now supports automatic generation of NSManagedObject subclasses in the modeling tool. In the entity inspector: Manual/None is the default, and previous behavior; in this case you should implement your own subclass or use NSManagedObject. Category/Extension generates a class extension in a file named like ClassName+CoreDataGeneratedProperties. You need to declare/implement the main class (if in Obj-C, via a header the extension can import named ClassName.h). - Class Definition generates subclass files named like ClassName+CoreDataClass as well as the files generated for Category/Extension. The generated files are placed in DerivedData and rebuilt on the first build after the model is saved. They are also indexed by Xcode, so command-clicking on references and fast-opening by filename works.



Codegen can be seen here无论我选择什么,它都不会生成。

我可能做错了什么或不完整,不是吗?

最佳答案

如果您将“Codegen”设置为“Class Definition”,就像在您的示例中一样,Xcode 会生成 NSManagedObject子类,但您实际上并没有在项目中看到。就像您发布的报价中所述,文件是在
~/Library/Developer/Xcode/DerivedData/...
您在项目中看不到它们,只有派生数据中的文件,您不必关心这些文件。 Xcode 确实有一个引用,所以命令+单击代码会按预期跳转到实现,而且您可以编写扩展等。

this answer 中查找详细信息.

关于ios - 无法创建托管对象的子类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40651545/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com