Xcode: An unexpected versioning side effect you can easily avoid

Again, I ran into a problem with Xcode that is not too obvious to solve. So I’d like to share my experience with you, so that you can prevent this situation.

The situation: You’re starting tests, and you get a result like this:

No update of the test result indicators — just black diamonds.

Well, I tried several searches, without a result. Nothing helped. The diamonds remained black.

Then, I remembered a similar problem long time ago with a different codebase (the above appeared with a new project I set up).

And I got a clue what was happening.

(Drum roll here.)

When I’m setting up a new project, one of the first steps is to add a build phase for the versioning:

if [ $ENABLE_PREVIEWS = NO ]; then
xcrun agvtool next-version -all

Should this be the reason? When commenting out these lines, the testing works as expected:

So, obviously, this build phase is the reason for the Xcode misbehaviour. But where to put the versioning instead?

The answer: The scheme. Add the code to the “Build” step, and you have both working properly: versioning and testing.

If you can explain the reason for this behaviour — let me please know and comment this article.

Helping companies and humans to evolve, and trying to be agile in an own product development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store