Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Values set in awakeFromInsert have gone missing.



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Values set in awakeFromInsert have gone missing. (From: Mike Zornek <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.