I want to print both the version and build number into my app on the app's Info and Credits screen. I've entered 1.2 in the "Version Number" on the summary page, and "D03" into the "Build Number" on summary page.

I then found this code snippet to print them,

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

However this only seems to print the value in "Build Number" not the value in version number. How do I access both the Build and Version numbers?

有帮助吗?

解决方案

I believe what you want to use is CFBundleShortVersionString. Here is the documentation on what you are looking for:

Apple's documentation

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top