正在加载今日诗词....
1 min read

iOS 持续集成 - fastlane 问题集锦

这里主要是收集一些自己在使用 fastlane 时遇到的小问题.
iOS 持续集成 - fastlane 问题集锦

问题

1. Apple Generic Versioning is not enabled in this project

使用 increment_build_number 时,会出现的问题
解决办法

target -> building setting 中, 搜索 current project version, 出现 versioning system 选择 Apple Generic

Apple Generic

2. Cannot set build number with plist path containing $(SRCROOT)

fastlane 无法识别出 $(SRCROOT)的路径
--解决方法; 网上查找的都是 找到项目的 info.plist 配置, 移除 $(SRCROOT)即可. 但是平时使用时 项目的 plist 却定位不了.--

fastlane 的 传参问题

格式 fastlane lane-name key1:value1 key2:value2 key3:value3

自定义 lane 的解析:

desc "Push a new beta build to TestFlight"
  lane :beta do |options| 
  	increment_build_number
    scheme = options[:scheme]
    export_method = options[:export_method]
    export_time = options[:export_time]
    build_app(workspace: "AppNameTest.xcworkspace",
     		  scheme: scheme, 
     		  clean:true, 
     		  include_bitcode: false,
     		  silent: true, 
			  export_method: export_method,
			  include_symbols: true,
     		  output_directory: "~/iOS/AppNameTest/build", 
     		  output_name: "AppNameTest${export_time}.ipa", 
     		  export_xcargs: "-allowProvisioningUpdates")
    changelog_from_git_commits
  	upload_to_testflight
  end

环境变量 来源 说明 备注
FASTLANE_USER credentials_manager Apple 开发者账户名 验证通过后会保存 Keychain
FASTLANE_PASSWORD credentials_manager Apple 开发者账户密码 验证通过后会保存 Keychain
FASTLANE_TEAM_ID
CERT_TEAM_ID produce
sigh Apple 团队 ID
DELIVER_USER
PRODUCE_USERNAME deliver
produce iTunesConnect 账户名
DELIVER_PASSWORD deliver iTunesConnect 账户密码
MATCH_PASSWORD match 证书加/解密密码
FASTLANE_XCODE_LIST_TIMEOUT