On 2008 Oct, 25, at 9:51, Quincey Morris wrote:

you must force it to be registered (processPendingChanges) and then you can tell the undo manager to remove it (removeAllActions).

Thank you, Quincey, that makes sense.

I also have a more fundamental question. Why must we override - initWithError:type: to initialize the 'department' ivar for new documents? It seems like we're "faking it". Generally, best practice is to allocate objects on-demand. And since good Cocoa citizens should be using getters, I propose instead alloc-init-setting it at the end of the getter -document implementation, after accessing the ivar and fetching it from the store have failed.

But when I tried that, a newly-created document didn't "work" (user could not type anything into any fields). NSLogging tells me that my getter -document is not invoked during initialization and therefore the -department ivar does not get set.

Apparently, sometime after initializing a new document, Core Data's internal magic is directly accessing my 'document' ivar under the table (and finding nil), instead of using the getter. How can I change my thinking to understand that this is expected behavior I need to design for?

Jerry

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to