• 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 available?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Obtaining version number of framework at runtime... API available?
  • From: Ray Rischpater <email@hidden>
  • Date: Tue, 13 Nov 2001 09:47:29 -0800

Thanks to all for the speedy response! Some comments below (primarily as
tokens of gratitude and to summarize for the archive...

On Monday, November 12, 2001, at 07:51 PM, Erik M. Buck wrote:

> See version
> + (int)version
>
Dang. That simple. :) That's exactly what I wanted for this. I'll do
that.

> Returns the version number assigned to the class. If no version has been
> set, the default is 0.
> Version numbers are needed for decoding or unarchiving, so older
> versions of
> an object can be detected and decoded correctly.
>
> Caution should be taken when obtaining the version from within NSCoding
> protocol or other methods. Use the class name explicitly when getting a
> class version number:
>
> version = [MyClass version];
>
Good. Important safety tip. That makes a lot of sense. I'd probably do
the other by mistake if you hadn't pointed it out at first...
>
> I usually implement plugins/loadable components with a single class or
> protocol to encapsulate whatever other classes and complexity may be
> contained in the plugin/loadable component. Each time the component
> changes
> in an incompatible way, I change the version of the principalClass via
> +setVersion in +initialize. When loading the plugin/component I
> use -versionForClassName:

That --- a wrapper class --- was exactly where I was going.

>
> Of course, the real art is to not break component compatibility from
> version
> to version.
Amen!

Some other thoughts:
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.

On Tuesday, November 13, 2001, at 03:08 AM, Stiphane Sudre wrote:
> Maybe adding a .plist file in the Resources folder of your Framework
> containing a Version entry is a solution to have a global Framework
> version.

I debated these --- but as Mr. Davidson says, these seem to be primarily
for machine-readable stuff. Moreover, I debated sticking a .plist file
with the version info, but it seemed overkill, given that frameworks
have their own versioning and so on.

Again, thanks to all!


References: 
 >Re: Obtaining version number of framework at runtime... API available? (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: Using NSBox in Interface Builder
  • Next by Date: Re: NSMovieView bug ?
  • Previous by thread: Re: Obtaining version number of framework at runtime... API available?
  • Next by thread: Getting user idle time - screenSaver?
  • Index(es):
    • Date
    • Thread