I want to get the version number from info.plist using:
NSString *version = (NSString *)CFBundleGetVersionNumber(CFBundleGetMainBundle());
That doesn't give me the string value from Bundle Version that I expect.
This does give me the string I expect:
NSString *version = (NSString *)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey);
I'd like to know how to get the first form to work since it looks like it's the preferred way to get the version from info.plist.
Here is how I'm using the result:
htmlAbout = [htmlAbout stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"[version]"] withString:version];
I'm working in Xcode 4.1
Thanks
a serious error in conversion exists in your program: CFBundleGetVersionNumber
returns UInt32
, which is not convertible via typecast to NSString
(or any objc type).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With