Invalid redeclaration on CoreData classes

前端 未结 2 1308
甜味超标
甜味超标 2020-12-23 01:55

I am working with CoreData, on an entity called \"RoleName\".

The problem is: I click on \"Create NSManagedObject subclass\" from within my model, and so it automati

2条回答
  •  Happy的楠姐
    2020-12-23 02:35

    From Apple : Whats 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.

    You don't need to manually create subclasses for NSManagedObjects.

    I would suggest that you delete the files that you created with NSManagedObjects (Move them to Trash) and go to every entity in the DataModel Inspector under Codegen select : Manual / None and create than the Subclasses.

提交回复
热议问题