On Sun, Oct 25, 2009 at 6:57 PM, Jay Reynolds Freeman <jay_reynolds_free...@mac.com> wrote: > I have an app, "MyApp", which has a user preferences file, properly located > in the user's Library/Preferences directory, and properly named > "com.Jay_Reynolds_Freeman.MyApp.plist". All is well and good with the > preferences mechanism, it works properly.
The fact that this file exists is an implementation detail. You should not rely on its existence. (For example, the implementation Managed Preferences—aka MCX—might change in the future to not write changes out to the plist, and you will need to respect those prefs. Heck, I'm not even entirely sure it does write them out now.) > MyApp also uses a special document, a binary file that it creates, whose > precise format keeps changing as I develop the app. In general, binary > files of this kind will *only* work with the precise version of MyApp that > created them: A mismatch causes a crash. And in the nature of development, > I usually have many different recent versions of MyApp lying around, as well > as instances of the corresponding different versions of the special > document. Well, hopefully you design your app so that a mismatch doesn't cause a crash, but rather a warning. > The binary-file documents are clickable -- you are supposed to be able to > launch the app by mousing on one. But if the wrong version of the app gets > launched by mistake, it fails. I would like to make that not happen, mostly > so that I can make sure I haven't somehow broken the click-on-to-launch > mechanism since the last time I tested it. > > The click-and-launch mechanism works fine when the finder can only "see" one > version of MyApp and the only binary-file documents around are of the > matching type. You should probably just change the extension used on your binary document, and only include an entry for that file extension in the version of the app which corresponds to that file extension. For example, version 1.0.1 of your app would create a binary file with the name Foo.myapp101, and only version 1.0.1's Info.plist would have an entry for this file type. Of course, bugs in Launch Services might make this difficult, especially during development. You can use the `lsregister` helper utility to nuke your Launch Services database if it starts associating the wrong version of your app with certain file types. > The problem is, I would like all versions of MyApp to use the same user > preferences list. What I need, in effect, is a way for all versions of > MyApp to announce themselves to the world as the same app when connecting up > with a user preferences file, but as completely different apps when the > system is trying to decide what to do with a binary-file document that I > have just moused on. That sounds like something that the Uniform Type > Identifier mechanism ought to be able to handle, but I can't quite figure > out how. This is an orthogonal issue. Your app's bundle ID shouldn't change between minor versions. CFPreferences will let you access the preferences associated with any bundle ID, so you could use that to import older preferences to the newer app, or share a set of preferences between them. --Kyle Sluder --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com