Re: My Core Data experiences
Re: My Core Data experiences
- Subject: Re: My Core Data experiences
- From: Brian Williams <email@hidden>
- Date: Tue, 23 Jan 2007 19:41:00 -0800 (PST)
As for problem one below, Apple confirmed that it's a bug. Good to know.
--- Brian Williams <email@hidden> wrote:
> Hi Cocoa-Dev,
>
> In my struggles with Core Data I have discovered some things for my self that
> are not discussed in the documentation. I hope that my experience will save
> someone grief in the future. I would also like to hear other peoples
> solutions
> and please fell free to disabuse me of any spurious ideas.
>
> 1) Life cycle and undo / redo:
>
> The documentation says "It is important to appreciate that Core Data "owns"
> the
> life-cycle of managed objects." It goes on to say that awakeFromFetch and
> awakeFromInsert should be used for any extra setup and then didTurnIntoFault
> should be used in place of dealloc. About didAwakeFromFetch it specifically
> says "awakeFromFetch is invoked when an object is re-initialized from a
> persistent store". While this is all true what is not said is that if you
> undo
> to a time before you managed object existed, didTurnIntoFault will be called,
> but that on redo neither awakeFromFetch nor awakeFromInsert will be called.
> The
> result is that you cannot depend on doing any setup that is not reflected in
> the model. This leads rule one:
>
> All managed object state must be in the model, even temporary values.
>
> So that means that there is no way to reliably setup observers in
> NSManagedObjects, or retain anything for that mater. Maybe it's obvious to
> others, but I got burned on that one.
_______________________________________________
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