<iOS 實(shí)踐經(jīng)驗(yàn)>Xcode9 fastlane 持續(xù)集成無法訪問 key-chain 的解決辦法

由于在Xcode 9 之后禁止其直接訪問鑰匙串, 導(dǎo)致持續(xù)集成時(shí)執(zhí)行 xcode build 會(huì)出現(xiàn)找不到證書或證書配置文件的問題:

Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.

這個(gè)可以修改 fastlane 配置文件來解決:

具體就是在調(diào)用和構(gòu)建相關(guān)的 action 的時(shí)候, 加入一個(gè): export_xcargs: "-allowProvisioningUpdates" 即可.

附上一個(gè)示例 FastFile:

fastlane_version "2.61.0"

default_platform :ios

platform :ios do
  before_all do
    cocoapods
    carthage
  end

  desc "Runs all the tests"
  lane :test do
    scan(
            device: "iPhone 6s"
    )
  end

  desc "Submit a new Beta Build to Apple TestFlight"
  desc "This will also make sure the profile is up to date"
  lane :beta do
    gym(scheme: "xxxxx", configuration: "Debug", export_method: "ad-hoc", export_xcargs: "-allowProvisioningUpdates")
  end

  desc "Deploy a new version to the App Store"
  lane :release do
    gym(scheme: "xxxxx", export_method: "app-store", export_xcargs: "-allowProvisioningUpdates")
  end

  after_all do |lane|
  end

  error do |lane, exception|
  end
end

使用該參數(shù)的情況下, 可能會(huì)在執(zhí)行持續(xù)集成構(gòu)建的機(jī)器上彈窗請(qǐng)求訪問鑰匙串的權(quán)限, 只要允許了即可.

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

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