Re: Values set in awakeFromInsert have gone missing.
Re: Values set in awakeFromInsert have gone missing.
- Subject: Re: Values set in awakeFromInsert have gone missing.
- From: Chris Hanson <email@hidden>
- Date: Tue, 31 Jul 2007 01:41:45 -0700
On Jul 30, 2007, at 10:26 PM, Mike Zornek wrote:
On 7/29/07 8:45 PM, "Marcus S. Zarra" <email@hidden> wrote:
This looks like a threading issue.
I don't think so (at least at this time). I've currently fixed it with
Chris's new init method. Though I'm still not sure why it's so much
better.
Your last -init method didn't return self and didn't invoke its
superclass's designated initializer. You were basically allowing
AppleScript to construct a partially-initialized and leaked instance
of your SBSession class as a side-effect of getting at a real
instance; +[NSEntityDescription
insertNewInstanceOfEntity:intoManagedObjectContext:] will return a new
instance, not the same one.
I suspect you were just mistyping or misremembering, and had meant to
use the NSManagedObject designated initializer,
-[NSManagedObject initWithEntity:insertIntoManagedObjectContext:]
all along instead of what you happened to type,
+[NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext:]
which is just a convenience factory method on NSEntityDescription.
Believe me, once you've coded into the small hours of the night, they
definitely start to look alike...
-- Chris
_______________________________________________
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