2. What is Fastlane?
• Automates beta deployments and releases for iOS & Android apps.
• Generates screenshots.
• Takes care of code signing.
• Very simple to use and remember commands.
3.
4. How to install?
1. Make sure that the latest version of Xcode tools is installed:
xcode-select --install
2. Use homebrew to install fastlane:
brew cask install fastlane
3. In terminal, navigate to your project’s root directory, and run the command:
fastlane init
5. After you run fastlane init for iOS, your project’s root directory will contain a fastlane folder:
6. What are those files in the fastlane folder for?
• Fastfile - contains script for building and uploading beta/release builds,
uploading screenshots and metadata.
• Deliverfile - Used when uploading your build / screenshots to
iTunesConnect / App Store.
• Appfile - contains app identifier, your Apple ID and Team ID.
8. Lanes are used to tailor your build processes to suit your needs.
9. Let’s go step-by-step.
First, the beta lane. This lane executes as follows:
1. increment_build_number : Increments build number by 1. You don’t have to
do it manually by opening up Xcode and typing in the new build number.
2. gym : This tool builds your project and produces the .xcarchive folder. The
archive will show up in Xcode’s Organizer.
3. testflight : This tool uploads you’re ipa file to Apple’s Testflight.
10. Now let’s go through the appstore lane:
1. snapshot : This tool generates screenshots for your app automatically. You
have to create a UI Testing target for your app in Xcode and record a UI test.
More on this later.
2. gym : Same as before.
3. deliver : This tool uses the Deliverfile to upload screenshots to iTunes Connect.
4. slack : Finally, a message is posted on slack regarding the upload.
11. How do I run this script?
In your terminal, just type in:
fastlane beta to run the beta lane
fastlane appstore to run the appstore lane
12. lane :beta do
cert(
development: true,
force: false,
username: "Your_Apple_ID",
keychain_password: "Your_Keychain_Password"
)
gym(
scheme: "Your_Scheme_Name",
clean: true,
codesigning_identity: "Your_Certificate_Name",
export_method: "app-store", use_legacy_build_api: true
)
testflight(
username: "Your_Apple_ID",
app_identifier: "Your_App_Bundle_Identifier",
skip_submission: true,
skip_waiting_for_build_processing: true
)
end
My Script
13. Short Explanation
The script does the following:
1. cert checks if a development certificate is installed locally in the machine. If not, it can create one.
2. gym builds the .ipa file for the app. The codesigning_identity to be used for building is passed. For
Testflight/App Store builds, export_method must be app-store. legacy_build_api must be true for
SwiftSupport folder to be created.
3. testflight uploads the build to Testflight. username and app_identifier are used to connect to
iTunesConnect. skip_submission set to true to only upload the build and not promote to app store.
skip_waiting_for_build_processing set to true so that the script exits after submitting build.
14. It generally takes 5 - 10 minutes to get the email from Apple regarding the status
of your build.
Compare this to uploading builds using Xcode which will take hours of effort to
upload a single build. Also, the Fix Issue button is dangerous to use, as it might
reset all provisioning profiles.
Fastlane is way cleaner.