最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

fastlane自動(dòng)化打包iOS APP過程示例

 更新時(shí)間:2022年07月20日 15:04:54   作者:QiShare  
這篇文章主要為大家介紹了fastlane自動(dòng)化打包iOS APP的過程示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

概述

APP自動(dòng)化打包常見的主流工具有Jenkins、fastlane。Jenkins功能強(qiáng)大,但是需要的配置也比較多,團(tuán)隊(duì)較大的可以優(yōu)先考慮,fastlane是用Ruby語言編寫的一套自動(dòng)化工具集,比較輕便,配置簡(jiǎn)單,使用起來也很方便。本文會(huì)詳細(xì)的介紹fastlane從安裝到上傳APP到蒲公英的整個(gè)流程。

fastlane的安裝

第一步

因?yàn)閒astlane是用Ruby語言編寫的工具,所以必須保證已經(jīng)配置好了Ruby開發(fā)環(huán)境。可以使用如下命令行查看是否安裝了Ruby:

ruby -v

如果有以下提示說明,你已經(jīng)安裝了Ruby:

ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin21]

如果沒有安裝需要先安裝ruby,本文對(duì)安裝ruby不作教程說明。

第二步

安裝Xcode命令行工具

xcode-select --install

如果沒有安裝,命令會(huì)有提示框,根據(jù)提示一步一步安裝即可。 如果出現(xiàn)以下命令提示,說明已經(jīng)安裝成功:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

第三步:

Ruby和Xcode環(huán)境都配置好之后,執(zhí)行以下命令來安裝fastlane:

sudo gem install -n /usr/local/bin fastlane

安裝完成之后,輸入以下命令查看是否安裝成功:

fastlane --version

出現(xiàn)以下提示說明你已經(jīng)安裝成功了:

fastlane installation at path:
/Users/xxxxxx/.rvm/gems/ruby-2.7.0/gems/fastlane-2.206.1/bin/fastlane
-----------------------------
[?] ?? 
fastlane 2.206.1

fastlane的配置

到你的iOS項(xiàng)目下,執(zhí)行初始化命令:

fastlane init

命令執(zhí)行完成之后會(huì)給出我們?nèi)缦聨讉€(gè)提示:

[?] ?? 
[?] Looking for iOS and Android projects in current directory...
[16:54:04]: Created new folder './fastlane'.
[16:54:04]: Detected an iOS/macOS project in the current directory: 'xxxx.xcworkspace'
[16:54:04]: -----------------------------
[16:54:04]: --- Welcome to fastlane ?? ---
[16:54:04]: -----------------------------
[16:54:04]: fastlane can help you with all kinds of automation for your mobile app
[16:54:04]: We recommend automating one task first, and then gradually automating more over time
[16:54:04]: 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
?  

命令執(zhí)行到最后有What would you like to use fastlane for?提示,此時(shí)fastlane列出幾個(gè)選項(xiàng),需要我們告訴它使用fastlane需要執(zhí)行哪種操作:

  • 第一種獲取App Store的App預(yù)覽照片。
  • 第二種打包上傳至TestFlight工具上。
  • 第三種打包上傳到App Store。
  • 第四種自定義打包方式。

以上四種方式根據(jù)自己的需要自行選擇,本文主要介紹打包上傳至第三方平臺(tái),所以選擇4自定義打包方式。選擇完成之后,fastlane會(huì)在我們項(xiàng)目中創(chuàng)建fastlane文件

[16:54:32]: ------------------------------------------------------------
[16:54:32]: --- Setting up fastlane so you can manually configure it ---
[16:54:32]: ------------------------------------------------------------
[16:54:32]: Installing dependencies for you...
[16:54:32]: $ bundle update
[16:54:40]: --------------------------------------------------------
[16:54:40]: --- ?  Successfully generated fastlane configuration ---
[16:54:40]: --------------------------------------------------------
[16:54:40]: Generated Fastfile at path `./fastlane/Fastfile`
[16:54:40]: Generated Appfile at path `./fastlane/Appfile`
[16:54:40]: Gemfile and Gemfile.lock at path `Gemfile`
[16:54:40]: Please check the newly generated configuration files into git along with your project
[16:54:40]: This way everyone in your team can benefit from your fastlane setup
[16:54:40]: Continue by pressing Enter ?

創(chuàng)建好fastlane文件夾之后,Appfile是編輯我們相關(guān)App和開發(fā)者賬號(hào)信息的,一般不需要我們?nèi)ナ謩?dòng)修改。Fastfile是我們對(duì)自動(dòng)打包這個(gè)過程的完整配置,默認(rèn)的Fastfile文件內(nèi)容如下:

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
end

打包并自動(dòng)上傳 App 到蒲公英

安裝蒲公英的 fastlane 插件

fastlane add_plugin pgyer

編輯Fastlane 的配置文件 fastlane/Fastfile

lane :develop do
   target = "demo"
   configuration = "Debug"
   gym(scheme: target, configuration: configuration, export_method:"development")
   pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e")
end

以下是蒲公英平臺(tái)的說明:

  • 以上的 api_keyuser_key,請(qǐng)開發(fā)者在自己賬號(hào)下的 應(yīng)用管理 - App概述 - API 中可以找到,并替換到以上相應(yīng)的位置。
  • 在 Xcode 8.3 和 Xcode 8.3 以后的版本中,對(duì)于 build_appexport_method 的值,需要根據(jù)開發(fā)者的打包類型進(jìn)行設(shè)置,可選的值有:app-store、ad-hocdevelopment、enterprise。對(duì)于 Xcode 8.3 以下的版本,則不需要設(shè)置 export_method。

經(jīng)過以上配置后,就可以使用 Fastlane 來打包 App,并自動(dòng)上傳到蒲公英了。在終端下,定位到項(xiàng)目所在目錄,輸入以下命令即可:

fastlane develop

在成功的情況下,可以看到類似下面的信息:

[18:37:22]: Successfully exported and compressed dSYM file
[18:37:22]: Successfully exported and signed the ipa file:
[18:37:22]: /Users/xxx/Documents/workCode/xxxxx.ipa
[18:37:22]: -------------------
[18:37:22]: --- Step: pgyer ---
[18:37:22]: -------------------
[18:37:22]: The pgyer plugin is working.
[18:37:22]: build_file: /Users/dddd/Documents/workCode/xxxx.ipa
[18:37:22]: Start upload /Users/dddd/Documents/workCode/xxx.ipa to pgyer...
[18:37:43]: Upload success. Visit this URL to see: https://www.pgyer.com/xxxxx

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 2    | gym              | 61          |
| 3    | pgyer            | 20          |
+------+------------------+-------------+

[18:37:43]: fastlane.tools finished successfully ??

  • 設(shè)置一個(gè)版本更新時(shí)的描述信息:
lane :develop do
  build_app(export_method: "development")
  pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e", update_description: "update by fastlane")
end

打包上傳到Testflight

在Fastfile文件中加入下面命令:

desc "打包上傳到Testflight"
  lane :beta do
    # add actions here: https://docs.fastlane.tools/actions
   target = "demo"
   configuration = "Release"
   gym(scheme: target, configuration: configuration, export_method:"app-store")
   upload_to_testflight(
 	    username: "xxxx@dd.com",
            app_identifier: "com.xxxx",
          )

在命令行輸入:

fastlane beta

打包上傳的過程中會(huì)讓你輸入蘋果賬號(hào)的密碼,并且有可能會(huì)報(bào)下面的錯(cuò):

[00:20:28]: Login successful
[00:20:31]: Ready to upload new build to TestFlight (App: fffff)...
[00:20:40]: Transporter transfer failed.
[00:20:40]: 
[00:20:40]: Please sign in with an app-specific password. You can create one at appleid.apple.com. (-22910)
[00:20:41]: 
[00:20:41]: Your account has 2 step verification enabled
[00:20:41]: Please go to https://appleid.apple.com/account/manage
[00:20:41]: and generate an application specific password for
[00:20:41]: the iTunes Transporter, which is used to upload builds
[00:20:41]: 
[00:20:41]: To set the application specific password on a CI machine using
[00:20:41]: an environment variable, you can set the
[00:20:41]: FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD variable

這是因?yàn)槟愕腁PPLE賬號(hào)開啟了雙重驗(yàn)證,注意這句提示Please sign in with an app-specific password用app專用密碼登錄,提示你創(chuàng)建一個(gè)app專用密碼登錄Transporter,關(guān)于怎么創(chuàng)建app專用密碼本人不做講解,可以自行百度或者谷歌,使用app專用賬號(hào)即可解決此問題。

以上就是fastlane自動(dòng)化打包iOS APP過程示例的詳細(xì)內(nèi)容,更多關(guān)于fastlane打包iOS APP的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Flutter Widgets粘合劑CustomScrollView NestedScrollView滾動(dòng)控件

    Flutter Widgets粘合劑CustomScrollView NestedScrollVie

    這篇文章主要為大家介紹了Flutter Widgets粘合劑CustomScrollView NestedScrollView滾動(dòng)控件示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11
  • iOS應(yīng)用設(shè)計(jì)模式開發(fā)中職責(zé)鏈(責(zé)任鏈)模式的實(shí)現(xiàn)解析

    iOS應(yīng)用設(shè)計(jì)模式開發(fā)中職責(zé)鏈(責(zé)任鏈)模式的實(shí)現(xiàn)解析

    這篇文章主要介紹了iOS應(yīng)用設(shè)計(jì)模式開發(fā)中職責(zé)鏈模式的相關(guān)實(shí)現(xiàn)解析,示例代碼為傳統(tǒng)的Objective-C,需要的朋友可以參考下
    2016-03-03
  • 解決iOS13 無法獲取WiFi名稱(SSID)問題

    解決iOS13 無法獲取WiFi名稱(SSID)問題

    這篇文章主要介紹了解決iOS13 無法獲取WiFi名稱(SSID)問題,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-09-09
  • iOS獲取當(dāng)前設(shè)備WiFi信息的方法

    iOS獲取當(dāng)前設(shè)備WiFi信息的方法

    很多公司現(xiàn)在都在做免費(fèi)WIFI,車站、公交、地鐵、餐廳,只要是人員密集流動(dòng)的地方就有WIFI,免費(fèi)WIFI從最初的網(wǎng)頁認(rèn)證方式也逐漸向客戶端認(rèn)證方式偏移。本文主要介紹iOS獲取當(dāng)前設(shè)備WiFi信息的方法,有需要的可以參考借鑒。
    2016-09-09
  • 在iOS中實(shí)現(xiàn)谷歌滅霸彩蛋的完整示例

    在iOS中實(shí)現(xiàn)谷歌滅霸彩蛋的完整示例

    這篇文章主要給大家介紹了關(guān)于如何在iOS中實(shí)現(xiàn)谷歌滅霸彩蛋的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)各位iOS開發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • 淺談iOS11新特性:新增拖拽交互體驗(yàn)

    淺談iOS11新特性:新增拖拽交互體驗(yàn)

    這篇文章主要介紹了淺談iOS11新特性:新增拖拽交互體驗(yàn),iOS11新引入了拖拽相關(guān)的API可以幫助開發(fā)者快速的構(gòu)建拖拽交互,在iOS11中,使用這種API進(jìn)行APP的開發(fā)為設(shè)計(jì)提供了一種全新維度的用戶交互方式。
    2017-12-12
  • iOS實(shí)現(xiàn)圓角箭頭視圖

    iOS實(shí)現(xiàn)圓角箭頭視圖

    這篇文章主要為大家詳細(xì)介紹了iOS實(shí)現(xiàn)圓角箭頭視圖,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-04-04
  • iOS中valueForKeyPath的常用方法法示例

    iOS中valueForKeyPath的常用方法法示例

    這篇文章主要給大家介紹了關(guān)于iOS中valueForKeyPath的常用方法法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-07-07
  • Flutter之PageView頁面緩存與KeepAlive

    Flutter之PageView頁面緩存與KeepAlive

    這篇文章主要為大家介紹了Flutter之PageView頁面緩存與KeepAlive示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-10-10
  • iOS整個(gè)APP實(shí)現(xiàn)灰色主題的示例代碼

    iOS整個(gè)APP實(shí)現(xiàn)灰色主題的示例代碼

    這篇文章主要介紹了iOS整個(gè)APP實(shí)現(xiàn)灰色主題的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02

最新評(píng)論

安吉县| 岳普湖县| 江川县| 迁安市| 光山县| 新乐市| 无为县| 安阳市| 英德市| 惠东县| 怀集县| 碌曲县| 汉阴县| 聂拉木县| 南和县| 来宾市| 炉霍县| 丰顺县| 饶河县| 西城区| 河西区| 阿拉尔市| 青龙| 宜君县| 建昌县| 秦皇岛市| 山丹县| 遵义市| 余干县| 清原| 南召县| 鄂尔多斯市| 辽阳县| 嘉峪关市| 广宗县| 凭祥市| 汉川市| 赤城县| 饶平县| 高雄县| 龙泉市|