- Iphone product build version
- Marketing Release Version
- Build Version
- Information Property List File (Info.plist)
- Incrementing Build Versions
- Automating with the Apple Generic Versioning Tool
- Updating the Bundle Version Number
- Updating the Marketing Release Version Number
- Viewing Version Numbers
- Displaying Version Numbers
- Version vs build in Xcode
- 7 Answers 7
- Xcode 12.4 “Unsupported OS version” after iPhone iOS update 14.7
- iPhone listed with «(unsupported OS version)».
- Can’t Upgrade to Big Sur / Xcode 12.5
- 6 Answers 6
- Add/Update Unsupported iOS Version to Xcode
- Xcode DeviceSupport Directories
- Get DeviceSupport Files
- Add DeviceSupport 14.5 / 14.6 / 14.7 to Xcode
- Other Issues
Iphone product build version
I have mentioned in the past that I make use of agvtool to set the build number of my Xcode projects but I have never, until now, documented the process.
Marketing Release Version
The first thing to understand is the Apple generic versioning system and in particular the difference between the marketing version of an application and its internal development bundle version. The marketing version is the release version number of the application as presented to the end user. The Apple recommendation is to use three dot-separated integers as follows:
Since this is a marketing controlled version number you can decide to release version 1.5.1 of an application and then follow it with a version which includes a major upgrade numbered 2.0.0
Build Version
The build version number identifies a particular internal build of an application bundle. The internal build number may or may not correspond to an external release. Typically you may have several internal releases before issuing an external release that will also have a marketing version. The format of the build version string is largely up to you though you should still make it one or more dot-separated integers. I tend to just use a single integer (1,2,3,4…) but you can also use 1.0,1.1,1.2, etc. if you have need for it.
Information Property List File (Info.plist)
Both the marketing release version number and the build version number are stored in an application targets Info.plist file. The two keys of interest are as follows:
- CFBundleVersion — build version number
- CFBundleShortVersionString — release (marketing) version number
It is important to note that the internal build number is really just the Xcode bundle version string. This means that an Xcode project with multiple targets will have the same build version number for all targets. Each target can still have a unique marketing version but must share a bundle version. So for example, bundle version 53 may contain two targets one with a marketing version of 1.2.4 and the other with 1.0.8.
To setup a new project to follow the Apple generic versioning system you simply need to make sure each target in the project contains an Info.plist file with the two version keys initialised to your preferred values (e.g. you might start a new project with bundle version 1 and marketing version 1.0.0)
Incrementing Build Versions
I have seen several different strategies for incrementing the build version. Some people increment the build version each time they commit code to a code repository — in fact most version control systems have sufficient hooks to allow you to automate this. Since I am using Git I tend to only increment the bundle version when I reach a major project milestone. That milestone may correspond to an external release but not always. Whatever you decide I guess the important thing is to be consistent.
[As an aside I also store the first few characters of the Git commit name in a separate Info.plist key. See this earlier post for details.]
Automating with the Apple Generic Versioning Tool
You could manage the build numbers in your Info.plist files manually but, especially if you have multiple targets, it is much easier to do it using the agvtool that Apple includes with Xcode. On my system running 10.6.4 (Snow Leopard) with Xcode 3.2.3 the agvtool executable is at /Developer/usr/bin/agvtool . There is also a wrapper script at /usr/bin/agvtool that will call the correct version of agvtool if you have multiple Xcode installation folders. For the purposes of this discussion it makes no difference which way you invoke agvtool .
Updating the Bundle Version Number
To update the bundle version number ( CFBundleVersion ) for all targets in a project:
This will increment the value of the CFBundleVersion key in each Info.plist file contained in the project. So bundle version 10 will become bundle version 11. If you are using a more complex version number it will be incremented to the next major version number, so 2.5 will become 3 (another reason I do not bother with more complex build numbers). If you want to force the bundle version to a specific value you can do that as follows:
Updating the Marketing Release Version Number
You can also manage the marketing release version number with agvtool but this will not do what you want if you have multiple targets in a project each requiring a different marketing version number. The problem is that agvtool processes all Info.plist files and sets the key to the same value. This is fine for the bundle version which is the same for all targets but not for the marketing version.
Therefore each time you issue an external release you should set the CFBundleShortVersionString to your marketing (external release) version manually in the Info.plist for the target you are releasing.
Viewing Version Numbers
To view the bundle version number of the marking version numbers (one for each target):
Displaying Version Numbers
Since the version numbers are all stored in the Info.plist file for the current target it is easy to access the values to display them within an application:
This will create a string containing the application name followed by the release version number with the internal build number in brackets. For example: “MyApp v2.0.1 (29)”.
Источник
Version vs build in Xcode
I have an app that I developed with Xcode 3 and recently started editing with Xcode 4. In the target summary I have the iOS application target form with fields: identifier, version, build, devices, and deployment target. The version field is blank and the build field is 3.4.0 (which matches the version of the app from when I was still editing with Xcode 3).
My questions are:
What is the difference between the version and build fields?
Why was the version field blank after I upgraded to Xcode 4?
7 Answers 7
Apple sort of rearranged/repurposed the fields.
Going forward, if you look on the Info tab for your Application Target, you should use the «Bundle versions string, short» as your Version (e.g., 3.4.0) and «Bundle version» as your Build (e.g., 500 or 1A500). If you don’t see them both, you can add them. Those will map to the proper Version and Build textboxes on the Summary tab; they are the same values.
When viewing the Info tab, if you right-click and select Show Raw Keys/Values, you’ll see the actual names are CFBundleShortVersionString (Version) and CFBundleVersion (Build).
The Version is usually used how you appear to have been using it with Xcode 3. I’m not sure on what level you’re asking about the Version/Build difference, so I’ll answer it philosophically.
There are all sorts of schemes, but a popular one is:
- Major version — Major changes, redesigns, and functionality changes
- Minor version — Minor improvements, additions to functionality
- Revision — A patch number for bug-fixes
Then the Build is used separately to indicate the total number of builds for a release or for the entire product lifetime.
Many developers start the Build number at 0, and every time they build they increase the number by one, increasing forever. In my projects, I have a script that automatically increases the build number every time I build. See instructions for that below.
- Release 1.0.0 might be build 542. It took 542 builds to get to a 1.0.0 release.
- Release 1.0.1 might be build 578.
- Release 1.1.0 might be build 694.
- Release 2.0.0 might be build 949.
Other developers, including Apple, have a Build number comprised of a major version + minor version + number of builds for the release. These are the actual software version numbers, as opposed to the values used for marketing.
If you go to Xcode menu > About Xcode, you’ll see the Version and Build numbers. If you hit the More Info. button you’ll see a bunch of different versions. Since the More Info. button was removed in Xcode 5, this information is also available from the Software > Developer section of the System Information app, available by opening Apple menu > About This Mac > System Report. .
For example, Xcode 4.2 (4C139). Marketing version 4.2 is Build major version 4, Build minor version C, and Build number 139. The next release (presumably 4.3) will likely be Build release 4D, and the Build number will start over at 0 and increment from there.
The iPhone Simulator Version/Build numbers are the same way, as are iPhones, Macs, etc.
Update: By request, here are the steps to create a script that runs each time you build your app in Xcode to read the Build number, increment it, and write it back to the app’s
This is extended from the how-to article here.
In Xcode 4.2 — 5.0:
- Load your Xcode project.
- In the left hand pane, click on your project at the very top of the hierarchy. This will load the project settings editor.
- On the left-hand side of the center window pane, click on your app under the TARGETS heading. You will need to configure this setup for each project target.
- Select the Build Phases tab.
-
- In Xcode 4, at the bottom right, click the Add Build Phase button and select Add Run Script.
- In Xcode 5, select Editor menu >Add Build Phase >Add Run Script Build Phase.
- Drag-and-drop the new Run Script phase to move it to just before the Copy Bundle Resources phase (when the app-info.plist file will be bundled with your app).
- In the new Run Script phase, set Shell: /bin/bash .
Copy and paste the following into the script area for integer build numbers:
As @Bdebeez pointed out, the Apple Generic Versioning Tool ( agvtool ) is also available. If you prefer to use it instead, then there are a couple things to change first:
- Select the Build Settings tab.
- Under the Versioning section, set the Current Project Version to the initial build number you want to use, e.g., 1.
- Back on the Build Phases tab, drag-and-drop your Run Script phase after the Copy Bundle Resources phase to avoid a race condition when trying to both build and update the source file that includes your build number.
Note that with the agvtool method you may still periodically get failed/canceled builds with no errors. For this reason, I don’t recommend using agvtool with this script.
Nevertheless, in your Run Script phase, you can use the following script:
The next-version argument increments the build number ( bump is also an alias for the same thing), and -all updates Info.plist with the new build number.
And if you have a Settings bundle where you show the Version and Build, you can add the following to the end of the script to update the version and build. Note: Change the PreferenceSpecifiers values to match your settings. PreferenceSpecifiers:2 means look at the item at index 2 under the PreferenceSpecifiers array in your plist file, so for a 0-based index, that’s the 3rd preference setting in the array.
If you’re using agvtool instead of reading the Info.plist directly, you can add the following to your script instead:
And if you have a universal app for iPad & iPhone, then you can also set the settings for the iPhone file:
Источник
Xcode 12.4 “Unsupported OS version” after iPhone iOS update 14.7
After updating iPhone iOS version to 14.7+, Xcode 12.4 can no longer build to that iPhone device.
In Xcode when choosing a Build Destination (Product > Destination > [device] or from the UI dropdown shown below) the newly updated iPhone will have beside it (unsupported OS version) :
iPhone listed with «(unsupported OS version)».
Can’t Upgrade to Big Sur / Xcode 12.5
I’m stuck on Mac OS Catalina (old hardware) and cannot upgrade to Xcode 12.5 which requires Big Sur.
How can we add/update device support to Xcode to build to an unsupported iPhone version (iOS 14.7+)?
6 Answers 6
Add/Update Unsupported iOS Version to Xcode
Apple has no plans to update Xcode 12.4 to support iOS 14.6, 14.7, etc.
But we can copy Xcode version 14.5 DeviceSupport files (download if needed) and paste (or symlink) them into directories named 14.6, 14.7, etc. (Thanks to @LPG for note on symbolic links.)
Xcode DeviceSupport Directories
Xcode DeviceSupport directories are located at: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
(In Finder, right-click on /Applications/Xcode & choose Show Package Contents )
The list of directories will not include 14.6, 14.7 (or perhaps not even 14.5).
(If 14.5 directory is already present, simply copy/paste or symlink that directory to duplicate it with name as 14.6 or 14.7, etc. as needed, otherwise. )
Get DeviceSupport Files
The quickest way to grab device support files is from this (unofficial) Github project:
In particular, we want the 12.5 release candidate zip file (14.6, 14.7 do not exist yet):
Inside the 12.5 Release Candidate in Github, download this .zip
After the files are downloaded, double click on the .zip file to unpack them into a 14.5 directory:
Add DeviceSupport 14.5 / 14.6 / 14.7 to Xcode
Copy and paste the 14.5 directory into /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport .
Make a duplicate of 14.5 directory by copy and pasting it into the same directory (into DeviceSupport ) then rename the directory to 14.6, 14.7, etc. as necessary.
If Xcode is open, Clean Build Folder (under Product menu heading). I’m unsure if this is strictly necessary. (The next time I attached my phone, Xcode also updated & processed cache files from the device itself, which took several minutes.)
Close Xcode (if open).
Attach iPhone via USB. If you haven’t already updated your Mac OS to support your phone on 14.6 / 14.7, your Mac may ask you to update the Mac OS software in order to connect to your iOS 14.6 / 14.7 device. I accepted this update request. It took several minutes to complete. (I believe this is unrelated to Xcode, rather iTunes, & other Mac services, etc.)
I needed to reboot my Mac after this. Unsure if this is required for everyone.
Open Xcode. Open the build destinations dropdown beside Runner and your iPhone 14.6 / 14.7 device should (hopefully) no longer has the «(unsupported os version)» note beside it.
Now as a supported 14.6 / 14.7 phone device under Xcode 12.4, you should be able to build debug, profile & release versions of your app to your physical iPhone.
Other Issues
«Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window»
Источник