I've been trying for days to determine why I get EXC_BAD_ACCESS when I try to access a managedObject property from within an accessor of another property?
this code in main.m [[self note] setValue:@"HELLO WORLD" forKey:@"category"]; NSNumber *tmpVal = [NSNumber numberWithBool:![[[self note] valueForKey:@"isEncrypted"] boolValue]]; // if I type po [self note] I see the note description [[self note] setValue:tmpVal forKey:@"isEncrypted"]; // if I type po [self note] after this I get EXEC_BAD_ACCESS The if statement in the accessor is causing the problem: - (NSString *)category { NSString * tmpValue; [self willAccessValueForKey:@"category"]; tmpValue = [self primitiveCategory]; [self didAccessValueForKey:@"category"]; if ([[self valueForKey:@"isEncrypted"] boolValue]) { // THIS IS CAUSING THE PROBLEM // code to decrypt tmpValue } return tmpValue; } When I replace: if ([[self valueForKey:@"isEncrypted"] boolValue]) with if (1 == 2 ) or if (1 == 1 ) it works FYI: in my .h file @property (nonatomic, retain) NSNumber * isEncrypted; and @dynamic isEncrypted; in .m_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com