• 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: NSUserDefault controller bindings - observeValueForKeyPath called twice?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefault controller bindings - observeValueForKeyPath called twice?


  • Subject: Re: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • From: Alex Zavatone <email@hidden>
  • Date: Fri, 18 Aug 2017 06:47:28 -0500

Check to see how many observers you have.

> On Aug 18, 2017, at 4:23 AM, Nick <email@hidden> wrote:
>
> Hello
> I am having a weird problem.
> I have a slider and a textfield with number formatter, both bound to a
> NSUserDefaultsController's "values" controller key and the "someVal"
> property.
>
> I am also registering for notifications in the -viewDidLoad of the view
> controller:
>
> [[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:
> @"someVal" options:0 context:nil];
>
>
> The problem is that observeValueForKeyPath is being called twice every time
> I move the slider or enter a new value in the edit.
>
>
> The viewDidLoad is executed only once (checked with an NSLog).
>
>
> It is easily reproducible.
>
> Why this might happen?
>
> macOS Sierra.
> _______________________________________________
>
> 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

_______________________________________________

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: NSUserDefault controller bindings - observeValueForKeyPath called twice?
      • From: Nick <email@hidden>
References: 
 >NSUserDefault controller bindings - observeValueForKeyPath called twice? (From: Nick <email@hidden>)

  • Prev by Date: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • Next by Date: Re: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • Previous by thread: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • Next by thread: Re: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • Index(es):
    • Date
    • Thread