Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Gettings Version & Build Number

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?

like image 879
Flatlyn Avatar asked Dec 30 '12 03:12

Flatlyn


People also ask

Does Xcode 11 support SwiftUI?

Also the LaunchServices on macOS, now respects the selected Xcode when launching Instruments, Simulator, and other developer tools embedded within Xcode. Thus using these intuitive new design tools of Xcode11, SwiftUI can be used to build interfaces like dragging and dropping, dynamic replacement, and previews.

What's the latest version of Xcode?

Xcode is Apple's integrated development environment (IDE) for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS. It was initially released in late 2003; the latest stable release is version 14.0. 1, released on September 26, 2022, via the Mac App Store with macOS Monterey.

What version of Xcode has SwiftUI?

To develop with SwiftUI we will need a minimum version of Xcode 11. Also, the devices where we want to run an application with SwiftUI will have to have versions equal to or higher than: iPhone/iPad iOS 13. MacBook macOS Catalina 10.15.

Can I run Xcode 13 on macOS Catalina?

The latest version of Xcode you can run on Catalina (10.15. 4) is Xcode 12.4 and Command Line Tools 12.4.


1 Answers

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

Apple's documentation

like image 97
Joe Avatar answered Oct 01 '22 13:10

Joe