PDA

View Full Version : Core Data Regeneration




nashyo
Sep 6, 2012, 05:51 AM
When creating subclasses of NSManagedObjects and replacing existing subclasses, using XCodes autoregenerating tool, are category methods reinserted into the new subclasses?

If not, how do you preserve any methods you insert into these classes?



Reason077
Sep 6, 2012, 10:50 AM
XCode overwrites the generated files each type you run the "Create NSManagedObject subclasses..." command.

So, if you want to add your own methods to NSManagedObject subclasses, it's best to put them in a category (http://en.wikipedia.org/wiki/Objective-C#Categories), in a separate file. That way, XCode won't overwrite them when you regenerate.