1. Install the Xcode command-line tool
- Xcode-select –install fastlane
- Apple official website download (portal), recommended use of this!
2. Install the fastlane
- Fastlane relies on Ruby
- Check the version of Ruby, terminal Ruby –version
- X86_64 — Revision 67812 [x86_64]
- Supports versions 2.4 to 2.7
- There are three official installation methods
- Sudo gem install Fastlane is recommended
- Other methods (Portal)
3. Test the fastlane
- Environment variables have been configured
- You can execute the fastlane command in any directory
- Environment variables are not configured
- Add the user variable vim ~/.bash_profile
- Export PATH=/usr/local/bin:$PATH
- Save and exit, using source ~/.bash_profile for the configuration to take effect immediately
- Now the configuration is complete
4. Initialize Fastlane in the project
- In the project root directory
- OC projects use Fastlane Init
- Swift projects use Fastlane Init Swift
What would you like to use fastlane for? 1.Automate screenshots 2.Automate beta distribution to TestFlight 3.Automate App Store distribution 4.Manual setup - Manually setup your project to automate your tasks. (Help us capture the screenshot of the App displayed on appstore) 2. Automatically release the beta to TestFlight for internal testing. 3. Automatically package and publish to AppStore. 4 Manual Settings.Copy the code
- Upload fir. Im Select 4
5. Configure the Gemfile file
Source "https://rubygems.org" gem "fastlane" gem "cocoapods", '1.10.0' plugins_path = file.join (file.dirname (__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path)Copy the code
- If cocoapods is used in your project, make sure you configure it here and add the Cocoapods version number
- The terminal executes the bundle install
6. Configure the Fastlane -> FastFile file
- Specific information can be searched online, uploaded to fir. Im and these configurations are enough
Default_platform (:ios) platform :ios do desc "Upload ios app to fir. Im platform" If you haven't signed up for an adhoc certificate, sigh will automatically sign up for it and add it to Xcode. True) # The following two actions come from Fastlane-plugin-versioning, # increment Build for the first and set Version for the second. If you have more than one target, you must specify the target value, otherwise it will directly find the first plist to change the Build. Scheme = "xxxApp" ipa_dir = "./fastlane_build/"+ time.new. strfTime ('%Y-%m-%d') ipa_name = 'xxxApp_Fir increment_build_number_in_plist( # target: scheme, # build_number: '20210427001' # ) # increment_version_number_in_plist( # target: scheme, # version_number: '3.0.0' #) # gym(scheme: scheme + ". Xcworkspace ", scheme: scheme, export_options: {method: ["app-store", "ad-hoc", "package", "enterprise", "development", "developer-id"] teamID: }, xcargs: "-allowoningupdates ", output_directory: ipa_dir, output_name: Firim_api_token fiRIM (firiM_API_Token: "XXXXXX ") # token view on FIR. end endCopy the code
7. Load the plug-in
- Fastlane add_plugin versioning(version can be specified)
- Fastlane add_plugin firim(upload to FIR.im)
8. Pack and upload
- The terminal executes a Fastlane FIR