Xcode9 fastlane 持续集成无法访问 key-chain 的解决办法

由于在Xcode 9 之后禁止其直接访问钥匙串, 导致持续集成时执行 xcode build 会出现找不到证书或证书配置文件的问题:

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

这个可以修改 fastlane 配置文件来解决:

具体就是在调用和构建相关的 action 的时候, 加入一个: export_xcargs: "-allowProvisioningUpdates" 即可.

附上一个示例 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

使用该参数的情况下, 可能会在执行持续集成构建的机器上弹窗请求访问钥匙串的权限, 只要允许了即可.

你可能感兴趣的:(Xcode9 fastlane 持续集成无法访问 key-chain 的解决办法)