I want to read the bundle version info from info.plist into my code, preferably as a string. How can I succeed?
+2
A:
You can read your Info.plist as a dictionary with
[[NSBundle mainBundle] infoDictionary]
And you can easily get the version at the CFBundleVersion
key that way.
Finally, you can get the version with
NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleVersion"];
gcamp
2010-10-30 14:28:52
Perfect. That's a lot simpler than all the lines of CF* functions I was using... I was sure there must have been a quick way to get the NSDictionary.
Stew
2010-10-31 06:56:14