User login
Getting the Version String
bosshogg — Sun, 12/06/2009 - 20:07
So, a very common thing to want to do in your application is to display the version string. However, unless you know where to look, this can actually be a somewhat frustrating thing to try and do. The key here is the NSBundle class which will return you the main application bundle which you can then get an NSDictionary class from. Once you have the NSDictionary, you can then query any of the paired values from the info.plist file.
Sample code below for getting the App Version and the Copyright text.
+ (NSString*) GetAppVersion
{
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
}
+ (NSString*) GetAppCopyright
{
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"NSHumanReadableCopyright"];
}
- bosshogg's blog
- Login or register to post comments
Navigation
Recent blog posts
- How the iPad Killed Our iPhone App Sales
- Sending email from within iPhone apps
- iPhone Tie Down Calculator Created for Pacific Cargo Control
- My Opinings On The iPad
- Plug For A Good Small Company
- Gambling Planet Features Three Jacks Games
- Twist Tac Toads Available in the AppStore!
- Getting the Version String
- Your iPhone App Icon
- C++ On The iPhone
