preface
- You can automate tedious tasks such as generating screen shots, processing configuration files, and publishing applications. We pack many times a day, and traditional packing can be a waste of time, so we can use automatic packing to increase our efficiency
Website address: docs. Fastlane. Tools/plugins/ava…
Document links:
Plug-in: docs. Fastlane. Tools/plugins/ava… Command: docs. Fastlane. Tools/actions /
Let’s take a look at automatic packaging
Install the Fastlane
Install the Ruby environment first, refer to this article to configure the Ruby environment for Mac and install CocoaPods
1. Use Homebrew to install
sudo gem install fastlane
Copy the code
If the following situation occurs
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
Copy the code
Solution:
sudo gem install -n /usr/local/bin fastlane
Copy the code
Uninstall the Fastlane
sudo gem unstall fastlane
Copy the code
Update the Fastlane
It depends on how do you install it
1. Install using gem
sudo gem install fastlane
Copy the code
2. Use Homebrew for installation
brew upgrade fastlane
Copy the code
View the Fastlane location
Find the location of Fastlane first
which fastlane
Copy the code
The location is as follows:
/usr/local/bin/fastlane
Copy the code
View the Fastlane version number
fastlane --version
Copy the code
The results are as follows:
fastlane installation at path: / Library/Ruby/Gems/server/Gems/fastlane - 2.180.1 / bin/fastlane -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [✔] 🚀 fastlane 2.180.1Copy the code
Configuration Fastlane
1. Go to the specified directory
2. Download the certificate to your keychain, which requires developer certificate and publishing certificate
3. Initialize FastLane
fastlane init
Copy the code
There are four options to choose from,
[configure] 🚀 [configure] Looking for iOS and Android projects in current directory... [16:59:49]: Created new folder './fastlane'. [16:59:49]: Detected an iOS/macOS project in the current directory: 'KJTestCategoryDemo.xcworkspace' [16:59:49]: ----------------------------- [16:59:49]: - Welcome to fastlane 🚀 - [16:59:49] : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [16:59:49] : fastlane can help you with all kinds of automation for your mobile app [16:59:49]: We recommend automating one task first, and then gradually automating more over time [16:59:49]: What would you like to use fastlane for? 📸 Automate screenshots 2. 👩✈️ Automate beta distribution to TestFlight 3. 🚀 Automate App Store distribution 4 Manual setup - manually setup your project to automate your tasksCopy the code
Enter 1
[17:00:43] : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [17:00:43] : --- Setting up fastlane to automate iOS screenshots --- [17:00:43]: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [17:00:43] : fastlane uses UI Tests to automate generating localized screenshots of your iOS app [17:00:43]: fastlane will now create 2 helper files that are needed to get the setup running [17:00:43]: For more information on how this works and best practices, check out [17:00:43]: https://docs.fastlane.tools/getting-started/ios/screenshots/Copy the code
Enter 2
[17:00:49]: Parsing your local Xcode project to find the available schemes and the app identifier [17:00:49]: Resolving Swift Package Manager dependencies... [17:00:49] : $ xcodebuild -resolvePackageDependencies -workspace KJTestCategoryDemo.xcworkspace -scheme KJTestCategoryDemo [17:00:50]: ▸ Command Line Invocation: [17:00:50] ▸ / Applications/Xcode. App/Contents/Developer/usr/bin/xcodebuild resolvePackageDependencies -- the workspace KJTestCategoryDemo. Xcworkspace - scheme KJTestCategoryDemo [17:00:51] : ▸ resolved source packages: [17:00:51] : $xcodebuild showBuildSettings - workspace KJTestCategoryDemo. Xcworkspace - scheme KJTestCategoryDemo ✅ Successfully Created SnapshotHelper. Swift '. / fastlane SnapshotHelper. Swift '✅ Successfully created new Snapfile ats './fastlane/Snapfile' ------------------------------------------------------- Open your Xcode project and make sure to do the following: 1) Add a new UI Test target to your project 2) Add the ./fastlane/SnapshotHelper.swift to your UI Test target You can move the file anywhere you want 3) Call `setupSnapshot(app)` when launching your app let app = XCUIApplication() setupSnapshot(app) app.launch() 4) Add `snapshot("0Launch")` to wherever you want to trigger screenshots 5) Add a new Xcode scheme for the newly created UITest target 6) Add a Check to enable the `Shared` box of the newly created scheme More information: https://docs.fastlane.tools/getting-started/ios/screenshots/ [17:00:53]: If you want more details on how to setup automatic screenshots, check out [17:00:53]: https://docs.fastlane.tools/getting-started/ios/screenshots/#setting-up-snapshotCopy the code
Enter 3 and your Apple account and password
[17:02:24]: -------------------------------- [17:02:24]: --- Login with your Apple ID --- [17:02:24]: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [17:02:24] : To use App Store Connect and Apple Developer Portal features as part of fastlane, [17:02:24]: we will ask you for your Apple ID username and password [17:02:24]: This is necessary for certain fastlane features, for example: [17:02:24]: [17:02:24]: - Create and manage your provisioning profiles on the Developer Portal [17:02:24]: - Upload and manage TestFlight and App Store builds on App Store Connect [17:02:24]: - Manage your App Store Connect app metadata and screenshots [17:02:24]: [17:02:24]: Your Apple ID credentials will only be stored in your Keychain, on your local machine [17:02:24]: For more information, check out [17:02:24]: https://github.com/fastlane/fastlane/tree/master/credentials_manager [17:02:24]: [17:02:24]: Please enter your Apple ID developer credentials [17:02:24]: Apple ID Username:Copy the code
At this point we will notice that our directory has an extra folder under it,
Published to TF (TestFlight)
1. Upload command
fastlane ios tf
Copy the code
2. Problem summary
Missing plugins, solutions:
2.1 installationbundle install
2.2 Installing plug-insbundle exec fastlane add_plugin fir
The successes are as follows:
Normal release process,
Prompt lack of publishing certificate,
The next step is to wait for the packaging process, which succeeds as follows:
The next step is to upload to Apple Platform, where you will be prompted to log in to apple account:
Successful release interface:Total time: 12 minutes