Display subclass data in XCode Expression window
- by Nick VanderPyle
I'm debugging an iPhone application I've written using XCode 3.2 and I cannot view the relevant public properties of an object I pull from Core Data. When I watch the object in the Expressions window it only displays the data from the base NSManagedObject. I'd like to see the properties that are on the subclass, not the superclass.
If it helps, here's some of the code I'm using.
Settings is a subclass of NSManagedObject. I created it using XCode's built-in modeler. Declared like:
@interface Settings : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * hasNews;
@property (nonatomic, retain) NSString * logoUrl;
@property (nonatomic, retain) NSNumber * hasPaymentGateway;
@property (nonatomic, retain) NSString * customerCode;
...
In the interface of my controller I have:
Settings *settings;
I populate settings with:
settings = (Settings *)[NSEntityDescription
insertNewObjectForEntityForName:@"Settings"
inManagedObjectContext:UIAppManagedObjectContext()];
I then set the properties like:
settings.hasNews = [NSNumber numberWithBool:TRUE];
I've tried casting settings as (Settings *) in the Expression window but that doesn't help. All I see are the properties to NSManagedObject. I'm using NSLog but would rather not.