How often do you face the situation where your colleagues, QA, business or marketing report issues in test builds, but they forget to mention a build number or application version? And when they ask you about it, you spend a lot of time explaining the build number and application version, and where it can be found? When you have one to two builds per month the issue is not very big, but when you have a lot of different builds per week, it becomes cumbersome.
-For instance at tispr we build on each commit and every week for internal testing, and weekly demo’s for business & marketing departments.
Let’s solve this issue, by creating a build number and app version with maximum visibility for users!
Our solution: On the application icon. You must be thinking: A new icon for each new build?! Our answer is yes, why not.
Let’s look at the how:
Develop - it is type/name of build (if you have a different type of builds, for instance: Develop build, Business build, etc); 1.0.1 - application version; 1023 - build number
Add new “Run Script” in Xcode in “Build Phase”
Get build number and application version from info plist in script
Let’s imagine that we have a function with the name “addOverlayInfo” which has two parameters (name of incoming icon, name of icon that will be generated)
1 2 3
The result is something like this:
iPhonefirstname.lastname@example.org - the names of the current application icons
While the application builds the Xcode, the icons with the names
AppIcon60x60@3x.png will be generated, if you use Images.xcassets.
So, these names are used as second parameters in our calls.
Let’s find the icon path by name of the icon:
Create a path to save the generated icon:
And now the most important moment: Generating icons with an overlay, including the build number and application version.
Following a quick search on the internet we found that we will need these packages(imagemagick and ghostscript). Let’s install them:
To find the width of the incoming icon:
To generate the new icon with all the important information:
$TYPE_OF_BUILD - The name of our build.
To complete the process you might want to consider automating it by making it part of your Continuous Delivery process.
You can find the full script here: Code
This article was inspired by these posts: