Versioning of Xamarin iOS apps - ios

I wanted to know how you deal with the versioning of your iOS apps. CFBundleShortVersionString should match with the version submitted to iTunes Connect and CFBundleVersion is your unofficial build number.
For CFBundleShortVersionString often the format {MajorVersion}.{MinorVersion}.{Revision} is used. One could use the {Build} number for the CFBundleVersion. Another possibility would be to use some sort of revision number from the VCS or in my case the SHA1 hash of the commit of GIT.
If you submit an app to the app store the CFBundleVersion is used to determine if your app is an update. It is only allowed to use digits and the dot separator here and it should be higher than the older version. So using a hash doesn't work here and there is no revision number in GIT. Once the app is ready for release the app can use the same value for CFBundleShortVersionString and CFBundleVersion if you have some different naming for the build number which is not compatible with the app store.
Currently the only thing which comes to my mind is to manually enter the version number if the app is ready for release. So you start counting if you have v. 1.0.0 and increases the number if you provide a new release. If you have a new beta version (e.g. you are planning a new release 2.0.0), what do you use for CFBundleVersion? Or what if you use continous integration and a new build is generated each day at midnight?
Also is there an automated process which connects Xamarin Studio, Info.plist and GIT so that for example the build number is increased on each commit? And how does such a process look like?
Bonus question: What information do you show the user in the about dialog of the app?

This is not full answer on how to handle inserting version into Info.plist and iOS versioning but instead how MonoDevelop/XamarinStudio creates version number from GIT commits. Which you can probably use to hack some way to update your Info.plist.
https://github.com/mono/monodevelop/tree/master/scripts
This folder has 3 files .sh and .bat are just to compile third file(.cs) and execute it.
So if you look into this .cs file you will see:
How to get "git.exe"
How to run blame on version.config(this is file where you manually insert versions like(5.5, 5.7, 5.8...)
How to run "rev-list --count " + hash + "..HEAD" which means count all commits between last change to version.config file and current commit. So if version.config was changed 143 commits ago, version will be 5.5.0.143, you can of course still use 3rd place for service packs.
And also some output of this informations like for example buildinfo which can then be used by other parts of build process to insert into Info.plist.
I hope this helps you to solve your problem.

Related

How to increment build number for xcode project with Azure DevOps

I have an iOS project, for CI/CD was selected Azure DevOps, I created pipeline and configured it according to documentation. It creates builds and upload to Apple Center, the only one thing I cant find out how to manage is how to increment build number, now I am doing it manually in xcode before generating a build.
Before we used fastlane, and it has such a possibility. So the question is how to increment build number with Azure pipeline, or at least force it to run fastlane file, to do it before the build is created?
Thanks in advance for any advice.
Update:
Its after creation of test project and installing extension Mobile App Tasks for iOS and Android, I cant add it to the list of tasks in the pipeline:
How to include it?
Update:
In case someone struggling as me:
After I wrote into support, so the issue was quit simple:
"And these task points these new available Android tasks and iOS tasks, we can view them from the Utility tasks when selecting tasks in pipelines, as below."
You can install the Mobile App Tasks for iOS and Android extension that gives you the ability to "bump version":
Change app's version name and code at build time.
Inputs:
sourcePath: Path to info.plist
versionCode: code number that must be an integer
versionCodeOffset: a specific number to increment the version code
versionName: user visible name (short code)
printFile: output the file before and after changing variables

Should I erase build number when uploading a new version?

If for example, I have an app with the version of 1.0 and it has 30 builds (build 30 was uploaded to the App Store).
When I'll release version 1.0.1 should I erase the build number to 1? Or should it be 31?
Should it be 1.0.1 (1) or 1.0.1 (31)?
Technically for an iOS app the build number could start from 0 (or 1) again. For a Mac app that is not allowed. Wether you SHOULD do that is a different question.
Convention is that the build number always increments, also after a version number change.
See Apple's description of this:
https://developer.apple.com/library/content/technotes/tn2420/_index.html
From the ios docs
For every new build you submit, you will need to invent a new build number whose value is greater than the last build number you used (for that same version). For iOS apps, you may re-use build numbers when submitting different versions. For macOS apps, you must chose a new build number for every submission that is unique and has never been used before in any submission you have provided to the App Store (including build numbers used in previous versions of your app).
So you can use 1.0.1 (1) or 1.0.1(31) but I would really prefer later one. I couldn't remember during my development remembering version number, we always refer build version within the team. And our build version is always greater than the previous build version.
You can ask why we follow this? The answer is because it looks logically right for us and also android versioning follows the same thing
From android docs
versionCode — An integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName setting, below. The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.
For an iOS app versioning the version would consist of 1.2.3, 1 being a major release, 2 being a minor release and 3 being the bug fixes. For every build version we can have as many builds as possible starting from any number. As per versioning standards we follow it from 1 whenever the version increases and build version always increases.
As others have mentioned, you should not reset the build number for new versions.
A method I often use is to add a script to the build phases of the target. That way, the build number continually updates without manual intervention.
In my case, I base the build number on the number of Git commits, but you can alter that to meet your needs.
REV=`git rev-list HEAD | wc -l`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

Can I release a bug fix for an already released ios version? Can I push a new version number before releasing the previous one?

Longish question for a potentially simple answer, but context might help provide an answer to the question I don't know to ask. :)
We have an app currently available on Android and PC that we are now pushing to ios. We are struggling to figure out how to make the app store versioning system fit with our existing system.
Our existing version number is of the format xx.yy.zz. When we start on a new release we increment yy and set zz to 0. I.e., if our last published version was 3.23.5, then we set the version number to 3.24.0. For each candidate build that we push to testing we increment the last number (so the next candidate would be 3.24.1).
So certainly we could make the ios version number be xx.yy and the build number zz.
But what happens when we need to push a quick patch for a release because we discover a bug? For our other platforms that would be, for example, 3.24.2. Can we release a build for version 3.24 to the app store after that version has already been made publicly available?
Alternately, we could make the version number be the whole xx.yy.zz number, and simply push new version numbers for each testing candidate even though previous versions have not been released. Is this a no-no?
If neither of these options is possible our trouble is we either have to make some process changes (so build numbers on other platforms bump up to 3.25 on a small patch, which we don't want to do) or we have to make the ios version numbers slightly different. E.g., 3.24 could be the initial release of a version and 3.24.1 could be the follow up (causing some discrepancy between version numbers across platforms and also some build machine pain since we'll need to detect whether the build is public or not yet).
Note, I have read this: https://developer.apple.com/library/content/technotes/tn2420/_index.html
The questions, in case you missed them:
Can we push a new build for a version number that is already on the app store (i.e., a patch of a released version)?
Can we push a build with a new version number when the previous version number is not yet released? If we did this as a standard practice would Steve Jobs rise from the grave and strangle us (and worse, would Apple ban us)?
iTunesConnct is not that flexible unfortunatlly. To your questions:
Can we push a new build for a version number that is already on the app store (i.e., a patch of a released version)?
No, once the version is ready for sale you cannot change the binary. You will need to create a new version.
Can we push a build with a new version number when the previous version number is not yet released? If we did this as a standard practice would Steve Jobs rise from the grave and strangle us (and worse, would Apple ban us)?
Not as far as I know. You will need to release the version in order to upload a new one (with a new version number). You cannot have more than one version pending release. If you try to click on the 'Add version' button while you already have version pending review/release - the button will be disabled. You can do that for different platforms - one build for iOs and one for tvOs.
Hope this helps.

Can I use a git SHA for the vsn field in an Erlang application?

What are the requirements for the vsn key in an Erlang application?
The Erlang/OTP documentation simply says:
Version number, a string. Defaults to "".
Is there any required ordering between versions? If I use a git SHA, will I still be able to use relups or appups?
To rephrase:
Is there anything in Erlang/OTP that requires a well-defined partial or total ordering in the vsn key?
The version can be any string, but with your idea I see 2 problems:
You will loose the ability to make comparison on version easily, I mean that you will need to maintain a catalog of all existing versions just to know if one version is older than an other (it should be accessible via git)
but as far as git works at the project level, you cannot know the SHA, and as the app file is part of the project, you cannot fill the version before commiting unless the app file is out of the git repository, which is not really interesting.

Jenkins Update xcode app version to Hockeyapp

I'm developing a CI (Continuous Integration) for my application.
So, I'm using Jenkins with HockeyApp (equal to TestFlyApp).
The problem is that HopckeyApp only accepts new versions of an application if it different versions from the last one added, else it gives me an error of already existing version, and no update.
I was reading about the apple tool Agvtool to update the value CFBundleShortVersionString.
My main problems are,
how to do this in Jenkins automatically.
How to update the project repository (Git in my case),for the next build it knowing which is the last version that was updated, or any other option to keep track of the last version updated.
I am trying to do this, but other approach will be accepted has well.
Thanks in advance.
It is recommended to update the CFBundleVersion and not the CFBundleShortVersionString, see http://support.hockeyapp.net/kb/how-tos/how-to-do-versioning-for-beta-versions-on-ios-or-mac
The following blog posts goes through the whole setup and also shows how to automatically update the version number using git tags: http://monitzer.com/?p=75
Here is another approach using git to update the version number: https://gist.github.com/3395649

Resources