• 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: Multiple instances of [NSUserDefaults standardUserDefaults]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple instances of [NSUserDefaults standardUserDefaults]


  • Subject: Re: Multiple instances of [NSUserDefaults standardUserDefaults]
  • From: Dave Keck <email@hidden>
  • Date: Sat, 23 Oct 2010 07:48:01 -0400

> Well, I've got some code, which I presume used to work, which relies on
> observing a value in the user defaults. The observer isn't getting triggered, so
> I am guessing it is because they are separate instances. Both should be on the
> main thread.

Are you observing an instance of NSUserDefaults or
NSUserDefaultsController? NSUD doesn't support KVO – perhaps that's
the problem?

Also, for testing at least, you might as well allocate your own
NSUserDefaultsController instance and stick it in an ivar. That way,
pointer comparison in -observeValueForKeyPath: should always work as
expected if different instances are indeed being returned by the
convenience constructor.
_______________________________________________

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: Multiple instances of [NSUserDefaults standardUserDefaults]
      • From: Chris Idou <email@hidden>
References: 
 >Multiple instances of [NSUserDefaults standardUserDefaults] (From: Chris Idou <email@hidden>)
 >Re: Multiple instances of [NSUserDefaults standardUserDefaults] (From: Dave Keck <email@hidden>)
 >Re: Multiple instances of [NSUserDefaults standardUserDefaults] (From: Chris Idou <email@hidden>)

  • Prev by Date: Re: Multiple instances of [NSUserDefaults standardUserDefaults]
  • Next by Date: Thread safety of CGEventSourceFlagsState()
  • Previous by thread: Re: Multiple instances of [NSUserDefaults standardUserDefaults]
  • Next by thread: Re: Multiple instances of [NSUserDefaults standardUserDefaults]
  • Index(es):
    • Date
    • Thread