Reputation: 14824
I'd like to share a preference between two apps (a game and its editor). How can I best accomplish this? I thought the game could explicitly read from the editor's preferences plist, but I'm not sure what the cleanest way to achieve this is.
Upvotes: 5
Views: 898
Reputation: 84388
NSUserDefaults
maintains a list of domains to search. By default it just looks at your application's preferences file, but you can have it search other places.
You can do something like this:
NSUserDefaults *defaults = [[NSUserDefaults alloc] init];
[defaults addSuiteNamed:@"com.example.game.shared-prefs"];
To share preferences between apps.
Upvotes: 4
Reputation: 104708
Just drop down to CFPreferences APIs for the expert parameters. NSUserDefaults
' idea of preferences is for an app, but CFPreferences allow you to defines hosts, suites, and so on for the type of multi-app preferences you want.
Upvotes: 2