Re: observeValueForKeyPath:... called too often in macOS 12
Re: observeValueForKeyPath:... called too often in macOS 12
- Subject: Re: observeValueForKeyPath:... called too often in macOS 12
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Wed, 19 Oct 2016 13:43:58 +0700
> On 19 Oct 2016, at 13:01, Quincey Morris <email@hidden> wrote:
>
> On Oct 18, 2016, at 22:33 , Gerriet M. Denkmann <email@hidden> wrote:
>>
>> I have just done this (can send it to you if you are interested).
>
> I’d be interested at looking at it, if you can email it to me.
Already sent by separate mail.
>
>> Bug4: changes not keep on quit
>> Check: change a TextField; do not use CR or leave the TextField; quit the app. Start it again.
>> Maybe this is the way it should be. But in the age of autoSave it feels a bit strange though.
>
> I’m pretty sure this is nothing to do with KVO or user defaults.
>
> An edited text field won’t get “committed” back to the data model until you end editing (Tab or Return) unless you arrange for it to happen. There’s are two *informal* protocols (NSEditor and NSEditorRegistration) that bridge between editors and controllers. Both NSDocument and NSViewController implement both of these, but that would only work if the view controller registered itself with the document, but it doesn’t. In effect the NSWindowController intervenes between the document and view controller, but it *doesn’t* implement those protocols, so it breaks the chain.
>
> One way around this is to use a NSObjectController bound between the text field and the data model (user defaults in this case). NSObjectController implements the editor protocols, so this covers the case where the window closes while an edit is in progress. However, IIRC it doesn’t help when a document “save” occurs or when the app quits, for separate reasons.
>
> Anyway, my point is that I think this is an unrelated problem.
I am quite sure you are right. I will try to use an NSObjectController. Probably should have done so in the first place.
Kind regards,
Gerriet.
_______________________________________________
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