Chapter 6. Custom Managed Objects

At the moment, our Hero entity is represented by instances of the class NSManagedObject. Thanks to key value coding, we have the ability to create entire data models without ever having to create a class specifically designed just to hold our application's data.

There are some drawbacks to this approach, however. For one thing, when using key value coding with managed objects, we use NSString constants to represent our attributes in code, but these constants are not checked in any way by the compiler. If we mistype the name of an attribute, the compiler won't catch it. It can also be a little tedious, having to use valueForKey: and setValue:forKey: all over the place instead of just using properties and dot notation. ...

Get More iPhone 3 Development: Tackling iPhone SDK 3 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.