Re: Live updating user defaults from a prefpane to a running app
Re: Live updating user defaults from a prefpane to a running app
- Subject: Re: Live updating user defaults from a prefpane to a running app
- From: Greg Guerin <email@hidden>
- Date: Wed, 14 Jul 2010 09:20:01 -0700
Shamyl Zakariya wrote:
So first off, is there some built-in way to simply 'goose' the app
and cause its defaults bindings to trigger?
There are any number of ways. You could send a signal with the
standard C function kill(). You could send a distributed
notification (see NSDistributedNotificationCenter). You could send a
UDP packet, or a multicast packet. The list goes on: pipes, file-
system, shared memory, apple-events, etc.
Each way of sending has a corresponding way of receiving: sigaction
(), NSDistributedNotificationCenter handler, packet listener, etc.
If not, what's the best practice here? And if I were to use some
sort of apple event fired from the prefpane or some other technique
to let the app know its defaults have changed, how do I get the
user defaults controller in the headless app to apply the updates?
If I understand the question correctly, then when the signal is
received, your headless app calls -synchronize on the
NSUserDefaults. This assumes you don't have any shared-access
contention issues.
_______________________________________________
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