• home
  • products
  • bosshogg's blog
  • forums
  • about
  • contact us
Home › Blogs › bosshogg's blog

User login

  • Create new account
  • Request new password

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

  • Forums
  • Recent posts
  • Feed aggregator

New forum topics

  • Crash on 10,000 Lite Version 1.6
  • Crash on 1st gen iPhone, looking for iAd framework
  • One thing missing...
  • Hello from my iPad
  • Welcome NetDetective Users!
more

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
more

© Copyright 2009. All rights reserved.

  • home
  • products
  • bosshogg's blog
  • forums
  • about
  • contact us