• 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: Crashing resetting or releasing an NSManagedObjectContext [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crashing resetting or releasing an NSManagedObjectContext [SOLVED]


  • Subject: Re: Crashing resetting or releasing an NSManagedObjectContext [SOLVED]
  • From: Daniel Kennett <email@hidden>
  • Date: Wed, 6 May 2009 14:01:21 +0100

*Sigh*

All this effort, and it turns out to be a one-line fix. Obviously.

[NSManagedObjectContext -setRetainsRegisteredObjects:YES]

Calling that on the context solves all the problems I was having, and everything works perfectly now!

 Thanks,

-- Daniel

 _______________________

   email@hidden
   http://www.kennettnet.co.uk

Please include previous messages in any reply you send.



On 5 May 2009, at 09:46, Daniel Kennett wrote:

Thank you again for your helpful replies!

On a different note, when you comment out the "for (VetVisit" code, does it still crash on a VetVisit, or does it crash on a "Medication" object?


It still crashes on a VetVisit object.

I don't think I've solved the problem, but I have stopped it crashing. Putting a breakpoint on [VetVisit -release] showed me that NSFastEnumeration was releasing the object:

for (VetVisit *visit in [self vetVisits]) { // <-- Stack trace for [VetVisit -release] comes from here
[visit className];
}


I solved the crash by doing this:

NSArray *visits = [[self vetVisits] allObjects];

for (VetVisit *visit in visits) {
	[visit className];
}

... and now it works fine! The accessors for the vetVisits set are just the ones made by the Core Data wizard thing - they're declared like this:

@property (nonatomic, retain) NSSet* vetVisits;

... and implemented with this:

@dynamic vetVisits;

So, I've stopped the crash, but I'm thoroughly confused about what's going on and think I'm just papering over the problem.

_______________________________________________

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


References: 
 >Re: Crashing resetting or releasing an NSManagedObjectContext (From: Daniel Kennett <email@hidden>)
 >Re: Crashing resetting or releasing an NSManagedObjectContext (From: Keary Suska <email@hidden>)
 >Re: Crashing resetting or releasing an NSManagedObjectContext (From: Daniel Kennett <email@hidden>)

  • Prev by Date: Re: NSDistantObject exception when server trying to access registered clients using DO
  • Next by Date: Re: A tree data structure?
  • Previous by thread: Re: Crashing resetting or releasing an NSManagedObjectContext
  • Next by thread: Re: Crashing resetting or releasing an NSManagedObjectContext
  • Index(es):
    • Date
    • Thread