Fastlane自动化打包---安装篇
Fastlane自动化打包---打包上传蒲公英篇
参考文档:
2. Fastlane初始化
2.1为项目配置 fastlane
$ cd 项目目录
$ fastlane init
2.1.1. init过程中可能出现的问题 常见问题
(1)如果期间报错 Connection reset by peer - SSL_Connect,就需要执行:
$ brew update && brew install ruby // 重装 $ sudo gem install -n /usr/local/bin fastlane
(1.1)然后重新执行
$ fastlane init
这些是参考AD_Fastlane中的错误,实际当中我没有遇到,
如果没有遇到可以忽略
2.2. 步骤详情
2.2.1我选择的是第三个
下面的步骤也会按照第三个
来讲解,因为是小白,所以只能选择第三个
$ fastlane init
[✔] 🚀
[✔] Looking for iOS and Android projects in current directory...
[10:37:51]: Created new folder './fastlane'.
[10:37:51]: Detected an iOS/macOS project in the current directory: 'XXXXXX.xcworkspace'
[10:37:51]: -----------------------------
[10:37:51]: --- Welcome to fastlane 🚀 ---
[10:37:51]: -----------------------------
[10:37:51]: fastlane can help you with all kinds of automation for your mobile app
[10:37:51]: We recommend automating one task first, and then gradually automating more over time
[10:37:51]: What would you like to use fastlane for?
1. 📸 Automate screenshots `->自动截图`
2. 👩✈️ Automate beta distribution to TestFlight `->自动testfilght型配置`
3. 🚀 Automate App Store distribution `->自动发布型配置`
4. 🛠 Manual setup - manually setup your project to automate your tasks `->需要手动配置内容`
2.2.2接下来它会让你输入你的苹果开发者账号和密码密码输入过一次,下次默认自动登录了,千万不要输错了
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
? 3
[10:37:53]: ----------------------------------------------------------
[10:37:53]: --- Setting up fastlane for iOS App Store distribution ---
[10:37:53]: ----------------------------------------------------------
[10:37:53]: Parsing your local Xcode project to find the available schemes and the app identifier
[10:37:53]: $ xcodebuild -showBuildSettings -workspace FastlaneDev.xcworkspace -scheme FastlaneDev
[10:37:55]: $ cd `你项目的路径` && agvtool what-version -terse
[10:37:55]: --------------------------------
[10:37:55]: --- Login with your Apple ID ---
[10:37:55]: --------------------------------
[10:37:55]: To use App Store Connect and Apple Developer Portal features as part of fastlane,
[10:37:55]: we will ask you for your Apple ID username and password
[10:37:55]: This is necessary for certain fastlane features, for example:
[10:37:55]:
[10:37:55]: - Create and manage your provisioning profiles on the Developer Portal
[10:37:55]: - Upload and manage TestFlight and App Store builds on App Store Connect
[10:37:55]: - Manage your App Store Connect app metadata and screenshots
[10:37:55]:
[10:37:55]: Your Apple ID credentials will only be stored in your Keychain, on your local machine
[10:37:55]: For more information, check out
[10:37:55]: https://github.com/fastlane/fastlane/tree/master/credentials_manager
[10:37:55]:
[10:37:55]: Please enter your Apple ID developer credentials
[10:37:55]: Apple ID Username:
`你的Apple ID`
[10:38:16]: Logging in...
错误提示
当然密码输入错误或者是其他错误都会报错的我没有尝试过密码错误
,我的错误是另一个,是因为开发者账号协议没有同意
当有错误出现 就会询问你是否进行手动配置,如果你有把握手动配置就选择Yes,如果没有就选择NO,就会停止,解决错误重新自动配置
[10:38:16]: Logging in... [10:38:17]: -------------------- [10:38:17]: fastlane init failed [10:38:17]: -------------------- [10:38:17]: ["The request could not be completed because:", "Need to >acknowledge to Apple's Apple ID and Privacy statement. Please manually log >into https://appleid.apple.com (or https://itunesconnect.apple.com) to >acknowledge the statement."] [10:38:17]: Something failed while running `fastlane init` [10:38:17]: Tried using Apple ID with email '开发者账号' [10:38:17]: You can either retry, or fallback to manual setup which will create a >basic Fastfile [10:38:17]: Would you like to fallback to a manual Fastfile? (y/n)
2.2.3 然后苹果开发者账号认证登录完成
当然如果你的是企业账号或者公司账号关联多个开发者账号的话也会让你自己选择
[10:42:08]: Logging in... Password (for `开发者账号`): ********* Multiple teams found on the Developer Portal, please enter the number of the >team you want to use: 1) 3333333 "XXXXX Siti Technology Co., Ltd." (Company/Organization) 2) 3333333 "XXXXXX United Win Asset Management Co., Ltd." >>>(Company/Organization) 3) 3333333 "XXXXXXXX Financial Information Service Co., Ltd." (Company/Organization)
然后会询问是否在开发者账号下创建一个App
由于不想多创建,因为创建之后不能删除,所以我就找了一个废弃的来创建,把项目的Bundle identifier
修改一下就可以,然后重新走一个他会检测,如果已经在开发者账号中创建了就不会有这一步。[10:43:41]: ✅ Logging in with your Apple ID was successful [10:43:41]: Checking if the app 'Bundle identifier' exists in your Apple >Developer Portal... [10:43:41]: It looks like the app 'Bundle identifier' isn't available on the Apple >Developer Portal [10:43:41]: for the team ID '3333333' on Apple ID '开发者账号' [10:43:41]: Do you want fastlane to create the App ID for you on the Apple Developer Portal? (y/n)
2.2.4 init完成
[10:50:45]: Would you like to have fastlane manage your app's metadata?
[10:50:45]: If you enable this feature, fastlane will download your existing metadata and screenshots.
[10:50:45]: This way, you'll be able to edit your app's metadata in local `.txt` files.
[10:50:45]: After editing the local `.txt` files, just run fastlane and all changes will be pushed up.
[10:50:45]: If you don't want to use this feature, you can still use fastlane to upload and distribute new builds to the App Store
[10:50:45]: Would you like fastlane to manage your app's metadata? (y/n)
y
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/description.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/keywords.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/release_notes.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/support_url.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/marketing_url.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/promotional_text.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/name.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/subtitle.txt'
[10:51:18]: Writing to './fastlane/metadata/zh-Hans/privacy_url.txt'
[10:51:18]: Writing to './fastlane/metadata/copyright.txt'
[10:51:18]: Writing to './fastlane/metadata/primary_category.txt'
[10:51:18]: Writing to './fastlane/metadata/secondary_category.txt'
[10:51:18]: Writing to './fastlane/metadata/primary_first_sub_category.txt'
[10:51:18]: Writing to './fastlane/metadata/primary_second_sub_category.txt'
[10:51:18]: Writing to './fastlane/metadata/secondary_first_sub_category.txt'
[10:51:18]: Writing to './fastlane/metadata/secondary_second_sub_category.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/trade_name.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/first_name.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/last_name.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/address_line1.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/address_line2.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/address_line3.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/city_name.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/state.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/country.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/postal_code.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/phone_number.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/email_address.txt'
[10:51:18]: Writing to './fastlane/metadata/trade_representative_contact_information/is_displayed_on_app_store.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/first_name.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/last_name.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/phone_number.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/email_address.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/demo_user.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/demo_password.txt'
[10:51:18]: Writing to './fastlane/metadata/review_information/notes.txt'
[10:51:18]: Successfully created new configuration files.
[10:51:18]: Downloading all existing screenshots...
[10:51:19]: Successfully downloaded all existing screenshots
[10:51:19]: Successfully created new Deliverfile at path './fastlane/Deliverfile'
网上看到的错误
我没有遇到过
如果一直停留在bundle update
这个地方[09:36:01]: Installing dependencies for you... [09:36:01]: $ bundle update
关闭终端 打开项目文件夹,找到fastlane init过程中生成的Gemfile文件,并打开
#将https://rubygems.org,换成https://ruby.taobao.org
,说是被墙,但我没有遇到
然后打开终端,cd到当前项目,输入bundle update
注意事项: 过程当中会有很多填写密码或者询问(y/n) YES/NO 要留意看清楚什么意思