• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data debugging (Fritz Anderson)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Core Data debugging (Fritz Anderson)
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: Re: When filing bugs with RADAR are attachments confidential?
  • Next by Date: Re: Core Data debugging
  • Previous by thread: Re: Crash in ATIRadeonX2000GLDriver/IKImageFlowView - any workaround?
  • Next by thread: Re: Core Data debugging (Fritz Anderson)
  • Index(es):
    • Date
    • Thread