• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: observeValueForKeyPath:... called too often in macOS 12
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: observeValueForKeyPath:... called too often in macOS 12


  • Subject: Re: observeValueForKeyPath:... called too often in macOS 12
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 18 Oct 2016 23:01:26 -0700
  • Feedback-id: 167118m:167118agrif8a:167118sPhMd7EMZy:SMTPCORP

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.

> 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.

_______________________________________________

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


  • Follow-Ups:
    • Re: observeValueForKeyPath:... called too often in macOS 12
      • From: "Gerriet M. Denkmann" <email@hidden>
    • [NSEditorRegistration sidetrack] observeValueForKeyPath:... called too often in macOS 12
      • From: Michael Starke <email@hidden>
    • Re: observeValueForKeyPath:... called too often in macOS 12
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >Re: observeValueForKeyPath:... called too often in macOS 12 (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: observeValueForKeyPath:... called too often in macOS 12
  • Next by Date: Re: observeValueForKeyPath:... called too often in macOS 12
  • Previous by thread: Re: observeValueForKeyPath:... called too often in macOS 12
  • Next by thread: Re: observeValueForKeyPath:... called too often in macOS 12
  • Index(es):
    • Date
    • Thread