• 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: Live updating user defaults from a prefpane to a running app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Live updating user defaults from a prefpane to a running app
      • From: Lee Ann Rucker <email@hidden>
  • Prev by Date: UIPinchGestureRecognizer and MPMovieController view
  • Next by Date: Re: Adding an image to a project
  • Previous by thread: Live updating user defaults from a prefpane to a running app
  • Next by thread: Re: Live updating user defaults from a prefpane to a running app
  • Index(es):
    • Date
    • Thread