CoreData issue: -[NSManagedObject setValue:]: unrecognized selector sent to instance

后端 未结 8 704
温柔的废话
温柔的废话 2021-02-05 08:29

I just started with CoreData yesterday, and I\'m going crazy :( I created a project that uses CoreData (ticked the box -use CoreData). Created the entities, and then created the

8条回答
  •  不要未来只要你来
    2021-02-05 08:52

    Just to remind that, don't use capitalized variable name, it might affects the getters and setters not working properly.

    If you generated your NSManagedObject subclasses from the data model, everything should goes fine, although it is @dynamic, setters are be implemented by coredata, and because they are already implemented, you should not change it to synthesize. At least for me, coredata returns empty object after I change @dynamic to @synthesize.

    And don't forget to set the class name in the data model:

    enter image description here

提交回复
热议问题