• 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: Releasing an NSManagedObjectContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Releasing an NSManagedObjectContext


  • Subject: Re: Releasing an NSManagedObjectContext
  • From: Diederik Hoogenboom <email@hidden>
  • Date: Tue, 20 Mar 2007 21:34:04 +0100

Jim,

I am also using temporary contexts (in relation with multiple threads) and I never encountered this problem. That said, maybe sending a reset message to the context will do the trick?


Diederik

--
Diederik Hoogenboom
Obvious Matter
http://www.obviousmatter.com



On 19-mrt-2007, at 0:34, Jim Thomason wrote:

I have a temporary NSManagedObjectContext, used for some migration,
and when I'm done using it, I want to release it. Standard stuff.

Unfortunately, my fetched NSManagedObjects still exist when I try to
release my context, and I sometimes get an exception:

2007-03-18 18:21:11.535 Debtinator[4711] An uncaught exception was raised
2007-03-18 18:21:11.541 Debtinator[4711] The NSManagedObject with
ID:0x382ff0 <x-coredata://2E18AFC3-F2C9-4A2E-9AA7-D46BA377FF3D/ Frobnoz/p113>
has been invalidated.
2007-03-18 18:21:11.548 Debtinator[4711] *** Uncaught exception:
<NSObjectInaccessibleException> The NSManagedObject with ID:0x382ff0
<x-coredata://2E18AFC3-F2C9-4A2E-9AA7-D46BA377FF3D/Frobnoz/p113> has
been invalidated.


And it kills my app.

I seem to have had good luck by calling refreshObject:mergeChanges: on
all my registered objects when I'm done with the context, but I can't
truthfully say if that's really having an effect, or if it's just
coincidence. But, since I added those calls in, I only seem to crash
intermittently with the exception, instead of every single time.
Again, could just be coincidence.

So, I raise to you all....now what? What should I be looking for to
try and help isolate this issue? Is it a design flaw? Can I even
expect to do this with an NSManagedObjectContext, or do I need some
other approach/

I'd like to just release my objects when I'm done with them, but I'm
not retaining anything. I load up objects via fetchrequests or KVO
methods, but I don't retain anything. So how can I get rid of them?
The array from the fetch is autoreleased, and it's immutable, so I
can't go through and explicitly remove all the objects.

And I'm out of ideas. Any suggestions of how I can get rid of these
objects, or any other things I should be looking for in my managed
objects that could be causing this, I'd be greatly appreciative.

Thanks,

-Jim....
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40obviousmatter.com


This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Releasing an NSManagedObjectContext (From: "Jim Thomason" <email@hidden>)

  • Prev by Date: Re: Releasing an NSManagedObjectContext
  • Next by Date: Re: Source List / + / - / Gear
  • Previous by thread: Re: Releasing an NSManagedObjectContext
  • Next by thread: Completely mad caused by CIImage
  • Index(es):
    • Date
    • Thread