Sharing config settings between 2 cocoa apps
I am new to cocoa development and want to create a little app. For that app I need a background worker that is开发者_StackOverflow中文版 running all the time and a prefpane-app that gives the user the opportunity to change the settings for that background worker.
The gui for the prefpane is ready, the background worker is ready, too. One of the few missing things is how to share the preferences between both apps. How do I notify the worker about changes of the preferences? And how do I store it in a way that both can read/write to it?
For inter-process notifications, take a look at Foundations notifications - specifically NSDistributedNotificationCenter
.
As for sharing settings, NSUserDefaults
provides you with -addSuiteNamed:
, which allows you to add a shared domain into the search list.
精彩评论