Game World!

Join A World Of Gamers

Enter your email address:

Delivered by FeedBurner

Followers

Popular Posts

Monday, 28 June 2021

How do I run Xcodebuild?

 If you’re tired of building and running your iOS apps via Xcode’s ▶️ button, let’s explore an exciting way to build and run your apps without touching the ▶️ button (ever again).

  1. Build the project
  2. Install the app in the iOS Simulator
  3. Launch the app in the iOS Simulator

Overview

Xcode comes with a number of command line tools. These tools are capable of performing pretty much every thing you can do via Xcode’s UI. While you need a human to point and click certain buttons in Xcode to make it work, these command line tools can help automate the whole process of building and running your project. Powerful, right?

Collecting the Info

The pieces of information required to build and run the app via the command line are as follows:

  1. iPhone Simulator name and OS version
  2. Scheme
  3. Bundle id
Extract the iPhone Simulator name and OS from the Simulator
  1. simulator = iPhone 11 Pro Max, 13.1
  2. scheme = Example
  3. bundle_id = com.ihak.Example

Step 1: Build the project

xcodebuild: the command line tool that allows us to build our project. Run any one of the following commands, depending on if you have a project or a workspace.

Build

Step 2: Install the app in the iOS Simulator

xcrun: helps locate and run developer tools

Install

Step 3: Launch the app in the Simulator

In the final step, we’ll run the command to launch our app in the Simulator.

Launch

Run Script

The process of building and running the app via the CLI (Command Line Interface) is exciting but a bit lengthy. Especially when you compare it to pressing the Xcode’s ▶️ button.

Script

What’s Next?

This very simple script gives you the power to build and launch your app with a single-line command. It’s particularly useful when you’re thinking about automating the app-building process. This script can be extended to execute unit tests and archive your app to distribute it later.

Heartbeat

Exploring the intersection of mobile development and…

Floating Button

Button