<iOS 实践经验>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

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。