Re: Core Data debugging (Fritz Anderson)
Re: Core Data debugging (Fritz Anderson)
- Subject: Re: Core Data debugging (Fritz Anderson)
- From: email@hidden
- Date: Thu, 16 Jul 2009 15:51:13 -0400
On 17 Jul 2009, at 00:13 AM, Fritz Anderson <email@hidden> wrote:
> On 15 Jul 2009, at 6:14 PM, email@hidden wrote:
>> (gdb) po err
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>> 0x922e668c in objc_msgSend ()
(Earlier:)
>> NSError *err;
>> BOOL result = [moc save: &err];
> Are you sure moc isn't nil? Messages to nil yield zero-valued results,
> so result would be NO, but err would not be set.
>
> And I'm sure you've checked it, but have you made sure result is NO?
> Methods taking NSError ** don't return valid er
ror objects unless they
> have failed.
>
> — F
Thank you very much for your persistence. Of course it turned out that the moc reference was nil.
The moc ivar was in my application controller which I was trying to set in the init method. Since both the application controller and the application delegate are instantiated from the main NIB the delegate was still nil when it was called.
I have removed it completely and just called the longer winded [[NSApp delegate] managedObjectContext] when I need it. I suppose I could have set the ivar in the awakeFromNib when all NIB objects are guaranteed to have been instantiated.
Being used to Java I tend
to forget about the object being instantiated via the NIB and to be careful with lifetime issues surrounding it. If some others read this and avoid the same silly mistake then it will have been useful.
Anyway once again thank you for your help.
Tim Mowlem
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden