• 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: Multiple applications, one NSUserDefaults object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple applications, one NSUserDefaults object?


  • Subject: Re: Multiple applications, one NSUserDefaults object?
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 26 Nov 2007 15:08:13 +0100

Am 26.11.2007 um 06:49 schrieb Jerry Krinock:
On 2007 Nov, 25, at 21:13, Jacob Bandes-Storch wrote:
I've got a project going with a preference pane and a background application that both need to access the user defaults for the same domain. Currently I have the preference pane using [NSUserDefaults standardUserDefaults], and the app using CFPreferencesCopyAppValue and CFPreferencesSetAppValue with the prefPane's appID. Is there a way to get an NSUserDefaults instance in the app that modifies the domain of the preference pane, or am I stuck with the CF stuff?

Cheap and simple: I set the CFBundleIdentifier in my background helper's Info.plist to be the same as the main app, and then [NSUserDefaults standardUserDefaults] "just works".


(Although my main app is an app; I've never done a preference pane.)

That's dangerous, though. Launch Services may get confused over which Info.plist is authoritative, and may only load one of them, now, or in the future if Apple chooses to optimize something. You shouldn't have two distinct bundles with the same bundle ID.


Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de




_______________________________________________

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


References: 
 >Multiple applications, one NSUserDefaults object? (From: Jacob Bandes-Storch <email@hidden>)
 >Re: Multiple applications, one NSUserDefaults object? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Newbie question: NSDocument and standard file formats
  • Next by Date: Re: NSTableView, IB & NSUserDefaults
  • Previous by thread: Re: Multiple applications, one NSUserDefaults object?
  • Next by thread: Re: Multiple applications, one NSUserDefaults object?
  • Index(es):
    • Date
    • Thread