• 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: Obtaining version number of framework at runtime... API avail able?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining version number of framework at runtime... API avail able?


  • Subject: Re: Obtaining version number of framework at runtime... API avail able?
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 13 Nov 2001 08:19:54 -0800

On Tuesday, November 13, 2001, at 04:48 AM, Christian Mike wrote:

You can use:

myDict = [[NSBundle bundleForClass:[someClassInFramework class]]
infoDictionary];

And then pull out the strings using:

[myDict objectForKey:@"CFBundleGetInfoString"]
[myDict objectForKey:@"CFBundleVersion"]
[myDict objectForKey:@"NSHumanReadableCopyright"]
etc.

Michael Christian
Thomson multimedia Inc.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev

I missed the start of this thread, but I do have a couple of comments about the code listed above.

First, you shouldn't look up the CFBundleVersion key directly; it is meant to be machine-readable, and there is an API for recovering its numeric value, CFBundleGetVersionNumber. Unfortunately there is not yet an NSBundle API for this (there will be in the future) and CFBundle and NSBundle are not bridged, but CFURL and NSURL are, so you can get the bundle path, make an NSURL out of that, and create a CFBundle from it fairly easily.

Also, some of the other keys can have localized values, so if you are looking for a user-visible rather than a programmatic value, you may wish to obtain a properly localized version. Again, the API for this is in CFBundle, CFBundleGetValueForInfoDictionaryKey, and again an NSBundle equivalent will be available in the future.

Douglas Davidson


  • Prev by Date: NSMovieView bug ?
  • Next by Date: Re: Icon style button
  • Previous by thread: Re: NSMovieView bug ?
  • Next by thread: Re: Playing sounds without QT
  • Index(es):
    • Date
    • Thread