问题
In xcode 3 there was a helpful feature in the data model builder where you could highlight some attributes/relationships in an entity, right-click, and choose to copy method and property declarations to the clipboard. (You could choose if you wanted objective-c 2.0 property declarations also). Then you could paste them into your NSManagedObject subclass.
I see how you can still generate the entire class file; but this isn't helpful if you are adding attributes to an existing entity. Have they removed this feature from xcode 4? I used it all the time!
回答1:
See the Core Data Model Editor Help: Creating Objective-C Accessor Methods for a Managed Object
回答2:
You may find MoGenerator useful.
回答3:
Watch out for the fact that the special paste menu item only appears in the Edit menu not the contextual menu in the source editor.
来源:https://stackoverflow.com/questions/5327600/generate-code-for-core-data-attributes-in-xcode-4