PDA

View Full Version : Determine my app's version number programatically?




zkmusa
Aug 23, 2008, 10:16 AM
I have a disclaimer which I'd like to change only when the application has been updated (hence, the version number will have changed).

I'd like to programatically determine what the version number for my app. What's the correct function or class I should be looking in? Thanks!



Jeremy1026
Aug 23, 2008, 11:07 AM
Umm...silly question I'm sure but, since each release can only have one version number, why not just manually display it in your program?

zkmusa
Aug 23, 2008, 12:15 PM
Umm...silly question I'm sure but, since each release can only have one version number, why not just manually display it in your program?

Well, the point is to display the disclaimer only once when they update their program.

For future reference, this post (http://www.iphonedevsdk.com/forum/iphone-sdk-development/1548-read-info-plist-app-runtime.html#post9802)explains how to go about doing this very well. Just replace "myVersionNumber" with "CFBundleVersion".

kainjow
Aug 23, 2008, 01:36 PM
Well, the point is to display the disclaimer only once when they update their program.

For future reference, this post (http://www.iphonedevsdk.com/forum/iphone-sdk-development/1548-read-info-plist-app-runtime.html#post9802)explains how to go about doing this very well. Just replace "myVersionNumber" with "CFBundleVersion".

Not sure why they're using CoreFoundation functions. The Cocoa way:
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];