From some investigation, it seems Launch Services does not
strictly interpret CFBundleVersion as a NumVersion struct. In
fact, some of Apple's own apps violate the "nn.n.nxnnn" format,
such as Mail.app, which has an CFBundleVersion of "746.2".
Many of Apple's applications violate this in which case
CFBundleGetVersionNumber() returns 0 (radr://4577471). It's best
not to do what Apple does and actually follow the documentation.
I found that I couldn't get the version number for iMovie 4.0.1. When
I looked at its CFBundleVersion key, I found that the corresponding
value was "4.0.1 (3H10)" instead of "4.0.1", so
CFBundleGetVersionNumber was failing and returning zero. (Later
releases are better behaved.)
Since I have to do a few things differently based on iMovie version,
I ended up writing a routine to be a bit more rigorous in getting a
valid version number. It doesn't handle really big major version
numbers like Mail's 746.2 (which really is version 2.0.7, according
to Mail's About box), but iMovie's version numbers are more in line
with NumVersion, so this works for my case. If you need a bigger
range, modify away...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden