Re: Accessing a managedObject property from within an accessor of another property

2011-02-23 Thread Brad Stone
[A]nd then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. ~Bill Bryson On Feb 22, 2011, at 11:42 PM, Quincey

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Quincey Morris
That's a lot of information you posted. :) Unfortunately, *based on the posted information* there's nothing obviously wrong except that you've shot yourself in the foot using the debugger. Let's look, for example, at what one of the backtraces is telling you. You triggered this by typing 'po s

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
SCENARIO 1: The thread is: 0 - [SRMainWindowController toggleLock:] //self = (SRMainWindowController *) 0x20009d440 1-[NSToolbarButton sendAction:to:] - (IBAction)toggleLock:(id)sender { NSError *fetchError = nil; NSArray *fetchResults; NSFetchRequest *fetchRequest = [[

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
In my Note entity: self = (Note *)0x20027bda0 In my .h file have this property defined: @property (nonatomic, retain) NSNumber * isFlagged; and this in .m @dynamic isFlagged; and no custom accessors New code in my Note entity: - (void)setIsEncrypted:(NSNumber *)value { // see po #1 which

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Quincey Morris
On Feb 22, 2011, at 12:21, Brad Stone wrote: > I'm assuming since I can successfully change the string in category my > reference to [self note] is OK. This is an absolutely false assumption. If, as I'm hypothesizing, [self note] is returning a zombie object (or it becomes a zombie object after

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
The category gets changed properly: (gdb) po [self note] uid:319991742678124 category:HELLO WORLD isEncrypted:0 (gdb) po thisNote Then, after I try to set isEncrypted to [NSNumber numberWithBool:YES] I get this after I po thisNote. I'm assuming since I can successfully change the string in

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Felix Franz
On Feb 22, 2011, at 3:19 PM, Brad Stone wrote: > 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? Could you post the stack trace? Just for debugging purposed: What happens if you define

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Quincey Morris
On Feb 22, 2011, at 10:10, Brad Stone wrote: > 2) I'm using garbage collection Also, it's worth checking that you really have garbage collection turned on. It's easy mistake to turn it on in the project build settings and not realize that the target settings turn it off. The symptoms you've bee

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Quincey Morris
On Feb 22, 2011, at 10:10, Brad Stone wrote: > 2) I'm using garbage collection Then my money's on a memory management error with the [self note] object. Can you show the code for [self note] and/or show the strong reference that keeps it alive? ___

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
Quincey, Thanks for relying. It's good to have another developer to talk this thru with. 1) customer accessors for isEncrypted didn't work (I have a set exactly like category) 2) I'm using garbage collection 3) I tried [note isEncrypted] same error 4) i tried using a local ivar i..e Note *thisN

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Quincey Morris
On Feb 22, 2011, at 06:19, Brad Stone wrote: > 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"]; > NSNumb

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
Yes, all my other classes are prefixed with "SR" since this one. I haven't gotten back to fixing this. On Feb 22, 2011, at 10:22 AM, Uli Kusterer wrote: > On 22.02.2011, at 16:13, Brad Stone wrote: >> FYI - my managedObject is defined as such: >> >> @interface Note : NSManagedObject >> { >>

Re: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Uli Kusterer
On 22.02.2011, at 16:13, Brad Stone wrote: > FYI - my managedObject is defined as such: > > @interface Note : NSManagedObject > { > } That's probably not your problem, but just to eliminate it as a cause: You should prefix your class names. Apple has been known to create internal private cla

Fwd: Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
FYI - my managedObject is defined as such: @interface Note : NSManagedObject { } @property (nonatomic, retain) NSNumber * uid; @property (nonatomic, retain) NSString * category; @property (nonatomic, retain) NSNumber * isEncrypted; @interface Note (CoreDataGeneratedPrimitiveAccessors) - (NSS

Accessing a managedObject property from within an accessor of another property

2011-02-22 Thread Brad Stone
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] valu