Mobile Development 5 min read

iOS Real‑Device Packaging and Installation Process Using Fastlane

This guide walks through configuring iOS certificates, installing Fastlane, handling common installation issues, and using Fastlane or a build script to package and install an iOS app on a real device, complete with command‑line examples and troubleshooting tips.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
iOS Real‑Device Packaging and Installation Process Using Fastlane

iOS Real‑Device Packaging and Installation Process

1. Configure Certificates

1.1 Obtain and configure certificates

Refer to the "03.iOS Certificate Configuration Process" documentation.

1.2 Add certificates to the Xcode project

Install the project's certificate in the local keychain and click the provisioning profile to attach it in Xcode.

In Xcode, select the installed certificate and provisioning profile for the project.

2. Install Fastlane Packaging Tool

2.1 Install Fastlane via RubyGems

$ sudo gem install fastlane -NV

2.2 Initialize Fastlane after installation

$ fastlane init

Note: If the process hangs, terminate it and run $ bundle update fastlane in the project root.

2.3 Use Fastlane to build the app

a. Build a development package: fastlane ios dev
b. Build a UAT package: fastlane ios uat
c. Build an Ad‑Hoc (production) package: fastlane ios pord_adhoc
d. Build a package for the App Store: fastlane ios pord_store

3. Resolve Installation Errors

If Fastlane installation fails, first install Homebrew:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If the script cannot be accessed, use the CDN mirror:

$ /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

For Homebrew core tap failures, run:

$ cd "$(brew --repo)/Library/Taps/"
$ mkdir homebrew
$ cd homebrew
$ git clone git://mirrors.ustc.edu.cn/homebrew-core.git

For cask issues, clone the cask mirror similarly:

$ cd "$(brew --repo)/Library/Taps/"
$ cd homebrew
$ git clone https://mirrors.ustc.edu.cn/homebrew-cask.git

After Homebrew installs successfully, install ImageMagick or GraphicsMagick:

$ brew install graphicsmagick

4. Build Packages with a Custom Script

Run the provided build.sh script from the project root:

a. Development package: ./build.sh dev
b. UAT package: ./build.sh uat
c. Production Ad‑Hoc package: ./build.sh pord_adhoc
d. App Store package: ./build.sh pord_store

5. Connect Device and Install

After the package is built, connect the iPhone and install the app for testing.

The article also includes promotional links and QR‑code instructions, which are not part of the technical guide.

Mobile DevelopmentiOSBuild AutomationpackagingXcodefastlane
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.