Re: Implications of changing an app's bundle identifier
Re: Implications of changing an app's bundle identifier
- Subject: Re: Implications of changing an app's bundle identifier
- From: Darkshadow <email@hidden>
- Date: Sat, 24 Feb 2007 18:52:11 -0500
On Feb 24, 2007, at 3:17 PM, Bill Cheeseman wrote:
My products have used a bundle identifier in the Info.plist file that
includes the company's name, in compliance with standard Mac OS X
protocol.
Now, however, for good and sufficient business reasons, it is
necessary to
change the bundle identifier in the next versions of the products.
I wonder what repercussions I will have to deal with in my code
when I do
this. It occurs to me that others have likely been through this
process,
since company names do change.
The only thing I've thought of so far is that a user of a previous
version
will suddenly appear to have "lost" all the old preference
settings, because
the preference files are named using the old identifier. Offhand, I
think I
can easily hard-code a one-time search for the old file names and
rename the
files.
Is there anything else I should watch out for? In particular, I wonder
what's going to happen in the Launch Services database in terms of the
Finder recognizing the new version as the owner of old document
files. (I'm
not concerned about UTI's for Spotlight, because I haven't used
UTI's in
previous versions, but it would be interesting to hear thoughts on
that
issue, as well.)
Bill Cheeseman
I've done this, Bill. There really wasn't much to it. Launch
Services just seemed to pick up the change without needing any
prodding at all.
For the preferences, I moved them over by simply doing this in the
+initialize method in my app delegate:
+ (void)initialize
{
NSDictionary *oldPrefs = [[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"old.bundle.identifier"];
if ( oldPrefs ) {
[[NSUserDefaults standardUserDefaults] setPersistentDomain:oldPrefs
forName:[[NSBundle mainBundle] bundleIdentifier]];
[[NSUserDefaults standardUserDefaults]
removePersistentDomainForName:@"old.bundle.identifier"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
/* Whatever else you may have been doing here */
}
That was all I needed to do when I changed the bundle identifier, but
then I didn't have anything else that was dependent on it.
Actually, I also added in a #warning line to that, to remind myself
that I'm compiling with code that moves the old preferences over so
that at some point I'll remember to take it out, but that's just
personal preference there. I'm a bit absent-minded; I know I'd
forget all about it and it'd be version 100.0 before I looked at it
and thought "Oh yeah, I suppose I can take this out now..." ;)
------------------------------------------------
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