In Comviva we follow Automated Build distribution as per below —

  • AdHoc Build Creation Using FastLane
  • Distribution of builds to QA OR Stake Holders via Firebase
  • Jenkins Job SetUp to have Parameterised build against Git Branch / Environment etc

In this article — I am sharing details on first two pointers —

  • FastLane Setup
  • Firebase Build Distribution

Best Practice is to have one Runner Machine which takes care of all Certificates/ Provisioning Profiles and anyone can go there execute the job and get the IPA.

To start with — we need to make sure that we have setup our app on Firebase and downloaded GoogleService-Info.plist

FastLane SetUp

The tool fastlane( 
is a collection of Ruby scripts, so you must have the correct version of Ruby installed. 
Normally macOS comes with Ruby 2.0 by default, but you can confirm whether this is the 
case by opening Terminal and entering

Check if ruby is installed or not. Open terminal, run:

ruby -v

If it’s not installed, the easiest way to do so is via Homebrew a package manager for macOS. Install Homebrew by entering this Terminal command:

/user/bin/ruby -e \ "$(curl -fsSL https://raw/"

If above commands fails, then there will come a suggestion in to run that command. Rerun above command after running the suggested command

then install Ruby using:

brew update && brew install ruby

Run $ “brew lin — overwrite ruby” of Homebrew instructs you to do so.

Now you will install Xcode Command Line Tools(CLT). Let’s first check if it is already installed by entering below command in terminal, run:

xcode-select -—install

if it is already installed, you will get the error: xcode-select: error: command line tools are already installed, use “Software Update” to install updates. If not installed then installation will start.

Now, you are ready to install fastlane. Enter the below commands in your terminal, run:

sudo gem install -n /usr/local/bin fastlane —-verbose

You might have to enter password. Enter the System password if prompted.

Now you are ready to set up fastlane project

In terminal — Go To your project folder & execute below command to setup fastlane for project —

if prompted Manual setup — manually setup your project to automate your tasks

Enter the digit against it, we will set up manually. In this case above enter 1.

Back in the project folder, you’ll see a few new things: Gemfile, which includes the fastlane gem as a project dependency and a fastlane folder containing: Appfile: stores the app identifier, your Apple ID and any other identifying information that fastlane needs to set up your app. Fastfile: manages the lanes you’ll create to invoke fastlane actions. If fastlane init got stuck somewhere while executing bundle update. Follow the below steps to resolve this issue, Open the Gemfile and replace

source “” with source “” and save the file.

now again run below command in terminal:

bundle update

You will now generate a binary so you can perform an upload for ad-hoc. We’ll use the gym command to generate an .ipa file for this.

Creating the IPA file

Open terminal, go to your project folder, run:

fastlane gym init

Above command creates Gymfile in fastlane folder.

Open Gymfile in your text editor, disable smart quotes, and replace the contents of the file with below code:


This code does the following:

  1. Specifies where fastlane should store the .ipa app binary file
  2. This sends ad-hoc through for the export_method parameter value. This builds the app for testing. Any devices attached to your Apple Developer account on the portal can run the app.
  3. Includes bitcode from the build. Bitcode allows Apple to optimize your app.
  4. Includes symbols from the build. Including symbols allows Apple to access the app’s debug information.
  5. Allows Xcode to use automatic provisioning.

Open Fastfile in a text editor, then replace the contents of the file with and save:


platform :ios do
     desc "Create dev ipa"
     lane :build_beta_dev do
     gym(scheme: "DEV")

This code does the following:

  1. Provides description for the lane. Lane is collection of commands which run in sequence.
  2. Lane name is “build_beta_dev”.
  3. This enables the automatic provisioning in Xcode.
  4. This increments the build number by 1.
  5. This runs the gym command and sends scheme. In this case scheme is “DEV”. We can have multiple scheme and as per our needs we can specify here.

Open text editor, paste below code. Replace the <[BUNDLE_IDENTIFIER]> with the bundle identifier pf yours.


Name the file as .env.DEV. File name which starts with . is hidden.

Save the file and close.

Open Appfile in text editor, replace the contents with the following code:

  1. The bundle identifier of the App.
  2. Email address of the app-store or app-store connect.
  3. Team name

Make sure you have logged into xcode accounts using this dev account too and synced certs & provisioning profiles

Open terminal, go to your project directory, run:

fastlane build_beta_dev

This will create build folder containing .ipa file and .dSYM zip file.

Now, ad-hoc ipa is generated. Let’s upload it to firebase

Upload to firebase

Setting up the Firebase App Distribution Plugin

Next, you need to set up the Firebase App Distribution plugin. This tool allows you to upload to Firebase from fastlane with an action.

From Terminal, run the following command to add the App Distribution plugin to your fastlane installation:

fastlane add_plugin firebase_app_distribution
If the command prompts you with an option, select Option 3:
If for some reason, plugins not installed, try again after disabling VPN.

Next step is Login to firebase. Follow the steps mentioned in the website.

Now open Fastfile in text editor, paste the code below fastlane lane:

desc "Upload dev to Firebase"
lane :upload_firebase_dev do
ipa_path: "./fastlane/builds/<APP_NAME>.ipa",
release_notes: "<RELEASE_NOTES>"

This code does the following:

  1. Add description.
  2. Firebase upload lane name.
  3. Invokes the firebase_app_distribution action.
  4. .ipa path generated using command build_beta_dev
  5. Firebase app id.
  6. group name created in firebase.
  7. release notes to be published.

After all these setup, run the following command from Terminal:

fastlane upload_firebase_dev
Now go back to Gemfile revert the changes that you made. Replace http with https and save.

It’s always good to clean the build folder before running build command

To clean the build folder, paste the code below the line “platform :ios do”:

desc "clean"
     lane :clean do
     clear_derived_data(derived_data_path: "./fastlane/builds/")

Now combine all the lanes in a separate lane

Open Fastfile, write it below firebase lane:

desc "build and upload dev to firebase"
lane :do_everything_dev do

Run the command in terminal:

fastlane do_everything_dev

Above command builds ad-hoc, stores in build folder, and then uploads to firebase.

Stay with us for next article on the same — for Jenkins SetUp — to have Parameterised build against Git Branch / Environment etc.

Md Mozammil

Md Mozammil

Md Mozammil have been working as a Senior iOS Developer for around 3 years for a Fintech company. Most of his work lies in developing new features for various banks across different countries while...