CFBundleIdentifier & Application Version

  • Reading things like,

    http://developer.apple.com/qa/qa2004/qa1373.html

    which discuss CFBundleIdentifier, the example always given for what it
    should look like is of the form:

      com.mycompany.MyApp

    My question is, as different versions, of the same application, are
    released, it is a good idea or recommended that the CFBundleIdentifier
    reflect the version of the application as well. For example, one might
    have:

    com.mycompany.MyApp2007
    com.mycompany.MyApp2008
    com.mycompany.MyApp2009

    If it is not a good idea or not recommended, why?

    The tech note above does say:

    Note: Most Xcode templates give a generic default value for
    CFBundleIdentifier to try to avoid as many problems as possible. It is
    still important to set your own unique value, however, as applications
    with identical CFBundleIdentifier values will override each other.

    While it is obviously important that two different applications (say a
    word processor and a game) have unique identifiers, it isn't clear to
    me that different versions of the same application should have a
    unique identifier as there are other items in a plist for declaring
    the version of the application.
  • It's really up to you and the kinds of changes that you expect to happen between each version.  Having a single ID allows preferences to be mixed and matched if different versions of the product are used, but if you want to support the simultaneous use of last year's version and this year's version, or a pro and lite version, then that can get in the way.

    If you want to read last year's version's preferences and then copy those over into this year's version's preferences upon install/startup, then that could be a solution.

    If you want to, you can name this year's version's ID:

        com.mycompany.MyApp.2008

    to distinguish it from last year's:

        com.mycompany.MyApp

    > Reading things like,
    >
    > http://developer.apple.com/qa/qa2004/qa1373.html
    >
    > which discuss CFBundleIdentifier, the example always given for what it
    > should look like is of the form:
    >
    > com.mycompany.MyApp
    >
    >
    > My question is, as different versions, of the same application, are
    > released, it is a good idea or recommended that the CFBundleIdentifier
    > reflect the version of the application as well. For example, one might
    > have:
    >
    > com.mycompany.MyApp2007
    > com.mycompany.MyApp2008
    > com.mycompany.MyApp2009
    >
    > If it is not a good idea or not recommended, why?
    >
    > The tech note above does say:
    >
    > Note: Most Xcode templates give a generic default value for
    > CFBundleIdentifier to try to avoid as many problems as possible. It is
    > still important to set your own unique value, however, as applications
    > with identical CFBundleIdentifier values will override each other.
    >
    >
    > While it is obviously important that two different applications (say a
    > word processor and a game) have unique identifiers, it isn't clear to
    > me that different versions of the same application should have a
    > unique identifier as there are other items in a plist for declaring
    > the version of the application.
  • On Jul 11, 2008, at 9:40 AM, Eric Gorr wrote:

    > My question is, as different versions, of the same application, are
    > released, it is a good idea or recommended that the
    > CFBundleIdentifier reflect the version of the application as well.
    > For example, one might have:
    >
    > com.mycompany.MyApp2007
    > com.mycompany.MyApp2008
    > com.mycompany.MyApp2009
    >
    > If it is not a good idea or not recommended, why?

    In most cases I would expect that one would change the CFBundleVersion
    and other version-related items in the Info.plist rather than the
    bundle identifier.  There might be cases in which one would want to
    change the bundle identifier, though--perhaps for a sweeping, clean-
    break change in the app.  Remember that preferences and the like are
    keyed off of the bundle identifier, so changing it would give you some
    work to do in migrating older settings.

    Douglas Davidson
  • On Fri, Jul 11, 2008 at 9:40 AM, Eric Gorr <mailist...> wrote:
    > Reading things like,
    >
    > http://developer.apple.com/qa/qa2004/qa1373.html
    >
    > which discuss CFBundleIdentifier, the example always given for what it
    > should look like is of the form:
    >
    > com.mycompany.MyApp
    >
    >
    > My question is, as different versions, of the same application, are
    > released, it is a good idea or recommended that the CFBundleIdentifier
    > reflect the version of the application as well. For example, one might have:
    >
    > com.mycompany.MyApp2007
    > com.mycompany.MyApp2008
    > com.mycompany.MyApp2009
    >
    > If it is not a good idea or not recommended, why?

    That's not really a good idea. Many facilities identify applications
    by bundle ID. If your new app is truly an new version of the old app,
    then the bundle ID shouldn't change.

    Use the other Info.plist keys to identify the version of your
    application (such as CFBundleVersion).

    --
    Clark S. Cox III
    <clarkcox3...>
  • On Jul 11, 2008, at 1:01 PM, Douglas Davidson wrote:

    > Remember that preferences and the like are keyed off of the bundle
    > identifier, so changing it would give you some work to do in
    > migrating older settings.

    I am focused on your phrase 'and the like'.

    Other then preferences, what else is keyed off of the bundle identifier?

    So, just to be clear, would you generally consider it to be the case
    that a unique bundle identifier is intended to identify a unique
    application and not different versions of the same application?

    If this is true, then I could see how some feature of the OS (either
    now or in the future) would depend upon this being true - that a
    bundle identifier identifies a unique application. Is this a valid
    concern?

    Thank you.
  • On Jul 11, 2008, at 11:54 AM, Eric Gorr wrote:

    > Other then preferences, what else is keyed off of the bundle
    > identifier?
    >
    > So, just to be clear, would you generally consider it to be the case
    > that a unique bundle identifier is intended to identify a unique
    > application and not different versions of the same application?

    Generally, that is the case.  For example, Launch Services has
    mechanisms to locate an app by bundle identifier, and I believe
    AppleScript now has a way to address an app by bundle identifier; in
    such cases, the bundle identifier is regarded as more stable than the
    application name, and in general the preferred way to locate a
    particular application.

    Douglas Davidson
  • On Jul 11, 2008, at 12:58 PM, Gary L. Wade wrote:

    > It's really up to you and the kinds of changes that you expect to
    > happen between each version.  Having a single ID allows preferences
    > to be mixed and matched if different versions of the product are
    > used, but if you want to support the simultaneous use of last year's
    > version and this year's version, or a pro and lite version, then
    > that can get in the way.

    Assuming the CFPreferences API is being used, one can pass in a custom
    application id as a CFString. So, it would seem that if the behavior
    one wanted was to have a different preference file for a different
    version of an application, passing in an application id with version
    information appended to it would be the way to go - as opposed to
    declaring a unique custom identifier and using the
    kCFPreferencesCurrentApplication constant with the CFPreferences API.

    Of course, using a custom application id would likely have the side
    effect that the OS would not be able to directly connect the
    preference file to the application (assuming the OS does or would ever
    make the attempt), but the code should work properly. But, perhaps
    this would work correctly if the bundle identifier was

      com.mycompany.myapp

    and the custom application id passed into CFPreferences functions was:

      com.mycompany.myapp.2009