Re: Multiple instances of [NSUserDefaults standardUserDefaults]
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