• 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: Implications of changing an app's bundle identifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implications of changing an app's bundle identifier


  • Subject: Re: Implications of changing an app's bundle identifier
  • From: Darkshadow <email@hidden>
  • Date: Sun, 25 Feb 2007 20:26:16 -0500


On Feb 25, 2007, at 4:08 PM, Bill Cheeseman wrote:


if (oldPrefs) {
// ... look for a preferences file for the old version of
the application and, if found, turn it into a preferences file for this new
version. This should happen only the first time the user runs the new
version, so that subsequent user changes to the new preferences file
settings stick instead of reverting to the old preference file settings. The
old preferences file is left in place in case the user downgrades to the old
version after trying out the new version.
[defaults setPersistentDomain:oldPrefs
forName:@"new.bundle.identifier"];
[defaults synchronize];
} else {
// If there is no preferences file for the old version of
the application, either, then register initial user defaults.
NSDictionary *initialUserDefaults = [NSDictionary
dictionary]; // or whatever
[defaults registerDefaults:initialUserDefaults];
}



Bill, I don't know exactly how you're using preferences in your app, but don't you want to register the initial defaults *even if* you copy the old preferences over? I tend to use the registered defaults in my app - i.e. if someone puts a preference back to what the actual default is, I remove it rather than set it. The registered default still stays around in this case as a fall back. I don't _always_ do that, but often enough I do.


Plus, if you have any new defaults that aren't in your old preference file, you'd want to register that.

Other than that, I like this. I was actually thinking up some code that's pretty much identical. I'm agreeing that keeping the old preference file around is a good idea, after all. ;)

I still have two more of my apps that I'm currently working on that I'll be changing the bundle identifier on, so I think I'll be doing this rather than removing the old preferences for them.


------------------------------------------------ Darkshadow (aka Michael Nickerson) http://www.nightproductions.net



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Implications of changing an app's bundle identifier
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Implications of changing an app's bundle identifier (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: NSColor opacity
  • Next by Date: Re: Implications of changing an app's bundle identifier
  • Previous by thread: Re: Implications of changing an app's bundle identifier
  • Next by thread: Re: Implications of changing an app's bundle identifier
  • Index(es):
    • Date
    • Thread