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: Quincey Morris <email@hidden>
- Date: Wed, 19 Oct 2016 01:08:58 -0700
- Feedback-id: 167118m:167118agrif8a:167118sPhMd7EMZy:SMTPCORP
On Oct 19, 2016, at 00:49 , Gerriet M. Denkmann <email@hidden> wrote:
>
> Before:
>
> TextField1 bound Value to:
> Shared User Defaults Controller
> Controller Key = values
> Model Key Path = TextField1
>
> This worked fine.
Yeah, I didn’t realize you were binding to a NSUserDefaultsController. Since that implements NSEditorRegistration and NSEditor, switching to NSObjectController doesn’t improve anything.
The real problem is that it just doesn’t know when you app is about to quit. If you want to save text fields that are still being edited, make sure you invoke one of the NSEditor methods on the NSUserDefaultsController before you quit, e.g. “commitEditing”. That will force it to end editing.
However, you will have to consider related issues such as Sudden App Termination and Automatic App Termination. There are mechanism to suppress these, if your app is using them, while there are “unsaved changes”, but since your AppDelegate doesn’t implement the NSEditor protocols, there may be something you need to do manually, if the NSUserDefaultsController doesn’t do the right thing automatically.
_______________________________________________
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