How to publish an iOS App from Microsoft AppCenter to Apple App Store Connect

In this blog I will detail how you use Microsoft’s AppCenter to build an iOS app und publish it directly to iTunes Connect. This allows you to decouple the building, testing and distribution process from the developers. The developer only has to push the app to the repository (I am using Azure DevOps) and AppCenter takes care of the rest.

The steps to do so are:

  1. Create app project
  2. Configure build
  3. Add signing certificates
  4. Configure distribution to iTunes Connect

Create App Project

Open AppCenter and create a new project.

You can add AppCenter features to you app, but it’s optional. I already have a running app that I just want to build and distribute. Next step is to configure the build.

Build

Select the repository where the source code is hosted. I use Azure DevOps (free tier). Unfortunately, GitLab is not listed and in the free tier I am using it is not possible to add self-hosted git repositories.

AppCenter will connect to Azure DevOps via SSO and list the available projects.

This adds the repository to the build configuration. You’ll see the branches and last commit message.

To configure the build, click on the configuration option for the branch. The option will only appear when you hover with your mouse over the branch.

AppCenter will scan the project and find the available XCode settings.

You can configure the XCode version to be used for the build. This is very useful when you are using external libraries that do not work with newer XCode versions. For instance, the Fiori libraries included in my project were not released for 10.2.1 and the newer Swift version that comes with it. Therefore, the build exited with an error. Until SAP released an updated version of Fiori for iOS, I had to use XCode 10.2.

AppCenter offers options to automatically increase the build number, or run your XCTests.

Sign build

To be able to send the app to iTunes, you must sign the build using your certificate and provisioning profile. I wrote two blogs on how to get these:

When you have these available, you can start configuring the app signing. You upload the files and provide needed credentials for your private key.

Distribute

Next step is to define where you want to distribute the app to. You can send it to the official App Store, App Store Connect Users for your TestFlight beta testers, or to an internal Company Portal.

I am going to distribute the app to App Store Connect for TestFlight. Select App Store Connect. If you do not have yet an account linked to Apple, you can do this here.

AppCenter is connecting to App Store Connect and retrieves a list of apps. I only have one app available, making the selection easier. It also means that you have to create the app first in App Store Connect. AppCenter is not able to create the app definition for you.

Select the app and click on Assign.

In case 2FA is enabled for your Apple ID, you will have to provide an app-specific password. I wrote a blog an how to create an app specific password.

After informing the app-specific password, you get back to the previous screen. Click again on assign.

Now AppCenter is configured to connect to Apple Connect. Back at the Distribute builds section, you can select App Store Connect Users.

Result

You can now click on save or already start your first build.

Run build and distribute to App Store Connect

After the project is created and the build configured, you can start a build. AppCenter will find an available build agent, clone the repository, build, test, sign and distribute the app.

AppCenter

Waiting for a free build agent

Build starting

Distribute

After the build is done, the app is send to Apple Connect and processed there. Apple will check if the build is OK. This will take some time. The status of the build is Processing.

App Store Connect

When processing is done, you get an email form Apple.

The status of the app in AppCenter and App Store Connect changes and you can distribute the app to your beta testers via TestFlight.

Let the world know

Install SAP BUILD Admin module

After successfully installing BUILD (part1, part2) and sending out links or studies to your users, you may want to know how to administer the users going to be created in your instance. From the SAP BUILD GitHub site: https://github.com/SAP/BUILD#admin-settings.

“You can manage your user settings with the Admin module. Install the Admin module here:http://github.com/sapbuild/Admin. You can log in to the Admin module using your BUILD account details.”

What does the admin module give you? From the GitHub page, it is not clear. Here are some screenshots showing the admin functionality:

Looks interesting and is what you expect? Then read on to learn how to install the admin module.

Preparations

Download source code

GitHub location of the admin module: https://github.com/sapbuild/admin. Get it via git clone.

Command: git clone https://github.com/sapbuild/Admin.git

Use right Node.js version

Make sure to use the same node version as you have when installing BUILD. For instance, I`m using v 0.10.38. To change to this node version, I use nvmw.

Command: nvmw use v0.10.38

Enable C++ compiler

The BUILD admin module will, as the BUILD server, need to compile some files, so a C++ compiler must be available.

Command: call “C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\SetEnv.cmd” /Release /x64

Note: if npm cannot find a compile, you`ll get an error message like this one:

INSTALLTION

Command: npm install

This will download the dependencies and install them. If you are Lucky, this will only take some time and finish automatically without any error. In case you are a normal person, you`ll get an error. I got the same error message as I did during BUILD installation: a lock file was blocked.

Error

Solution

Run npm install again. Should solve the problem.

INSTALL NODE-INSPECTOR

Next is to install node-inspector. If you do not install node-inspector, the server won`t start. Looks like there is a dependency between the HTTP server and the debug option. https://github.com/node-inspector/node-inspector

Command: npm install -g node-inspector

RUN

After the admin module is installed, you can run it and access the web page to access your profile.

Command: grunt serve

Access the BUILD admin console on port 9000 of localhost: http://localhost:9001. Login with your BUILD user and credentials.

Let the world know

Getting started with BUILD – Installation

After meeting the pre-requirements for BUILD, it is time to actually install BUILD. The steps are outlined at SAP BUILD GitHub page. There a 4 steps:

  1. Get the tool
  2. Install required node modules
  3. Initialize the db
  4. Start the app

Be sure to have followed the steps outlined in the pre-requisites in my previous blog.

1. Get the tool

BUILD is hosted on GitHub, so all it needs to get the source code is git. It`s as of today only 255 MB that you have to download.

Command: git clone https://github.com/SAP/BUILD.git

2. Install required node modules

Change to the BUILD directory and run the following commands:

Command: npm install –g grunt-cli

Change to BUILD\BUILD directory. Install dependency of project

Command: npm install

Note: before doing this, verify that the command shell you are using is configured to use node v0.10.38

Command: nvmw use v0.10.38

Tip: The installation will have to compile some libraries using Microsoft C++ compiler. Make sure the compiler is using the right SDK.

Command: call “C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd” /Release /x64

Now the SDK is using the 64 bit version of the SDK.

Result

Node-gyp is compiling files.

In the end, you should see something like that:

Possible errors

Error: mocha\bin does not exist

Solution: try a npm cache clear, delete the local node_modules directory and run npm install again.

Error: Could not load the Visual C++ component

In case you did not point the SDK to use the right MSFT compiler, you get this error message:

Solution: Run from within cmd: call “C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd” /Release /x64

Error: EPERM with npm-cache

Solution: run npm install again. It should now pass this error. You may have to delete the lock file.

3. Initialize the database

Only needed after initial installation of BUILD.

Run the commands from the server directory.

Create schema

Command: node initSchema.js

The above command will create a DB schema called norman. Taking a look into the config file, reveals that there is a section for db. The defines a database named norman.


"db": {
"hosts": "localhost",
"database": "norman",
"options": {
"db": {
"w": 1
},
server": {
"poolSize": 5,
"socketOptions": {
"keepAlive": 1
}
}
}
},

Test

The see if the database was created in mongo db, connect to the db and issue the command show dbs.

Command: mongo.exe

Command: show dbs

Set access permissions

Command: node setDefaultAccess.js

4. Start BUILD app

Command: grunt serve

Result

Note the final line stating: Server started.

Access BUILD

This means that the http server is running at default port 9000 on localhost. Access it on Chrome.

Click on join to create an account. Afterwards, create a new project

  1. Enjoy BUILD

Have fun.

Let the world know

Getting started with BUILD – Pre requisites

SAP showed a demo of BUILD at its TechEd keynote at Las Vegas. The 1st time I tried to install BUILD on my laptop was shortly after it was launched and I was still in the hospital; and I failed getting it working. Afterwards I mainly interacted with BUILD using SAP`s internal system. The installation is not an easy next, next, next wizard (yet), but as BUILD is a really impressive tool for UX, AND OPEN SOURCE, I believe nobody should be left out of using BUILD just because the installation isn`t doable by everyone. So I created this blog showing how I installed BUILD on my Windows 7 64bit laptop. I hope it helps people getting started with exploring the powerful features of BUILD.

The GitHub project outlines the prerequisites as well as the actual installation steps. Meeting the prerequisites is a must, and not so easy, as you`ll need to have the right versions made available for build to work.

PREREQUISITES

The prerequisites are

  • GIT
  • npm.js in version1.4.28
  • node.js in version 0.10.33 or 0.10.38
  • MongoDB in version 2.6.x
  • node-gyp

Let me show you how I did make this work on a Windows 7 64bit laptop. Installing git is the easiest one. Just download it from git-scm.org. The others a little bit more complicated. Let me detail the steps here for each component.

NPM.JS

Command: npm –g install npm@1.4.28

Test

Command: npm –version

NODE.JS

You have basically two alternatives to install Node.js in version 0.10.38. Either you download it make sure that your cmd is using this version (PATH variable), or you activate the right version for your current session.

Download

There are several versions available for download from nodejs.org. You can opt to download the installer for a specific version or to download the executable. The URL to download the files for 0.10.38 is: https://nodejs.org/dist/v0.10.38/

To download just node.exe, download it from there and save it into a directory. Run node.exe from there and check that it is the right version number

Test

Command: node.exe –version

Node package manager

This is the alternative you should prefer. Easier to use, allows to have several node version in the system and done by npm. To do so, first install nvm. On Windows, you`ll have to use nvmw.

Command: npm install –g nvmw

Now you can use nvmw to install a specific version of node.

Command: nvmw install v0.10.38

Activate node.js 0.10.38

Command: nvmw use v0.10.38

Test

To see if 0.10.38 is now activated, run node with the version parameter

Command: node –version

Python

Download Python 2.7 installer and install python. Ensure that the python executable binary is in the path.

Test

Node-gyp

Looks like the installation of BUILD will have to compile some stuff, so node-gyp is being used. The installation of node-gyp is more complex and can be found here: https://github.com/nodejs/node-gyp/blob/master/README.md#installation

For Windows 7 64 bit, it means to install two components:

  • C++ compiler and
  • Windows 7 SDK

C++ compiler

The compiler is Microsoft Visual Studio C++ 2013 for Windows Desktop. Download it from Microsoft: http://www.microsoft.com/en-gb/download/details.aspx?id=44914

Select the version you want to download. I recommend the online installer.

After downloading the online installer, run it

Accept the license term to start the 7 GB install

Restart computer.

Windows 7 64bit SDK

Download the Windows 7 64bit SDK from Microsoft: http://www.microsoft.com/en-us/download/details.aspx?id=8279

Run the installer

Select the components you want to install. Best is to leave the default.

This starts the installation and download of necessary files.

Result: SDK is installed.

Afterwards, some strange Help Library Manager pops up and starts to fetch things from the Internet. Just let it finish and then exit it.

Possible error

Solution

“To resolve this issue, you must uninstall all versions of the Visual C++ 2010 Redistributable before installing the Windows 7 SDK. Checking the list of installed programs reveals that I do have this library installed.” Microsoft

Uninstall these components

Install mongo db

Download binary zip from Mongo DB. Version: mongodb-win32-x86_64-2008plus-2.6.11. Follow install instructions from Mongo DB.

  1. Extract zip file to folder: C:\dev\tools\mongodb-2.6.11
  2. Create db data folder data\db

  3. Start mongo db from bin directory. Start mongo db and give path of database directory as parameter:

    Command: mongod.exe –dbpath “C:\dev\tools\mongodb-2.6.11\data\db”

Note: without the db data directory, mongo db won`t start.

Let the world know