iOS Fastlane

  • 問題

    天天打包,即便面對的是膚白貌美小姐姐,終有安裝識別別煩我的苦惱以及事到一半打個包的郁悶,

    咋整?

    Fastlane吧!

  • 思路

    1.xcode-select安裝,確定安裝了最新版本

    xcode-select --install
    

    2.安裝fastlane, 單獨安裝,去掉sudo; 使用系統(tǒng)自帶的ruby,需要sudo權(quán)限

    sudo gem install fastlane
    

    3.項目根目錄,初始化fastlane

    fastlane init  // 命令行
    
    // 執(zhí)行效果
    [13:54:52]: Created new folder './fastlane'.
    [13:54:52]: Detected an iOS/macOS project in the current directory: 'Maxifix.xcworkspace'
    [13:54:52]: -----------------------------
    [13:54:52]: --- Welcome to fastlane ?? ---
    [13:54:52]: -----------------------------
    [13:54:52]: fastlane can help you with all kinds of automation for your mobile app
    [13:54:52]: We recommend automating one task first, and then gradually automating more over time
    [13:54:52]: 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
    ?  4
    [13:55:13]: ------------------------------------------------------------
    [13:55:13]: --- Setting up fastlane so you can manually configure it ---
    [13:55:13]: ------------------------------------------------------------
    [13:55:13]: Installing dependencies for you...
    [13:55:13]: $ bundle update
    

    4.配置下Fastfile文件

    default_platform(:ios)
    platform :ios do 
      lane :beta_release do |options|
        # 版本號設(shè)置
        increment_build_number(
          build_number: options[:buildnumber]
          )
        # 打包ipa文件
        buildapp(
          workspace: "xxx.xcworkspace",
          configuration: "Release",
          scheme: "xxx",
          export_method: "ad-hoc",
          output_name: "xxx.ipa"
          )
        
        # 上傳到蒲公英
        pgyer(api_key: "xxx", user_key: "xxx", update_description: options[:message])
      end
    
      desc "build app"
      private_lane :buildapp do |options|
        gym(
          workspace: options[:workspace],
          configuration: options[:configuration],
          scheme: options[:scheme],
          clean: true,
          export_method: options[:export_method],
          output_directory: "./fastlane/package/",
          output_name: options[:output_name],
          sdk: "iphoneos"
          )
      end 
    end
    
    

    5.控制Version版本號設(shè)置自增

    Versioning System 設(shè)置為Apple Generic
    

    6.添加pgyer插件,可上傳到蒲公英

    sudo fastlane add_plugin pgyer
    

    7.調(diào)用方式

    /usr/local/bin/fastlane beta_us_release message:"打包啦" buildnumber:101
    
  • 結(jié)語

    工程中的Pod執(zhí)行,可放在lane中執(zhí)行,或腳本執(zhí)行,各憑喜好不細說,

    可能問題:

    1.出錯fastlane_xcode_build_settings_timeout

    命令行中運行如下來更新timeout時間

    export FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT=120
    

    2.Fastlane bundle update執(zhí)行卡住

    檢查ruby源
    gem source -l
    
    替換源
    gem source --add https://gems.ruby-china.com/ --remove https://rubygems.org/
    
    替換Gemfile文件
    source "https://rubygems.org" 替換成  source "https://gems-china.org"
    
    刪除fastlane文件夾,打開終端,cd到工程目錄下,再次執(zhí)行fastlane init
    

    3.invalid byte sequence in US_ACSII錯誤

    解決方法:
    export LANG=en_US.UTF-8
    export LANGUAGE=en_US.UTF-8
    export LC_ALL=en.us.UTF-8
    
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • iOS自動化打包,我推薦fastlane 方案。fastlane 的原理又是如何?實現(xiàn)自動化打包,又有什么流程? ...
    素還真人閱讀 910評論 0 0
  • 之前腦殘讓公司購買了一臺iMac,這是我用過最卡的電腦,用來開發(fā)簡直要命,Xcode打包更是要命,每次都要十幾分鐘...
    Yanni雅尼閱讀 465評論 0 1
  • 一:Fastlane 安裝準(zhǔn)備工作 一、安裝xcode命令行工具 xcode-select --install 如...
    水之飛亦閱讀 600評論 0 0
  • Fastlane 使用大致流程如下: 思路弄清楚后操作時,參照demo中的文件修改即可。參數(shù)可以自定義配置(參數(shù)說...
    TeeMo_Yan閱讀 5,377評論 0 5
  • 今天感恩節(jié)哎,感謝一直在我身邊的親朋好友。感恩相遇!感恩不離不棄。 中午開了第一次的黨會,身份的轉(zhuǎn)變要...
    余生動聽閱讀 10,805評論 0 11

友情鏈接更多精彩內(nèi)容