iOS: Access app-info.plist variables in code

Attributes from the info.plist for your project are directly accessible by the following…

[[NSBundle mainBundle] objectForInfoDictionaryKey:key_name];

For example to get the version number you might do the following

NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];

There is a gotcha in that the version number now has two attributes in the info.plist – but you get the idea? If you view your info.plist as source code (right click the info.plist – select Open As) then you will get to see all the various key names you can use.

Leave a Comment