tgz/blog

给 fastlane 添加自定义 action

tgz opened this issue · 1 comments

tgz commented

http://imqsc.xyz/2018/05/14/create-fastlane-action/

最近公司在做新项目,iOS 这边,因为企业证书配置了 Wildcard App ID,无法使用推送等功能。之前的做法一直是配置另外一个 Target,使用不同的配置来实现 fastlane 自动打包。 这种做法存在的问题是,每次新加入文件,都需选中多个 target ,如果忘记了,会导致打包失败。 因此,希望能在打包步骤来关闭项目的 Push notifications 开关。 First Ste

使用了博主推荐的 Xcodeproj 库, 顺利的解决了xcode11下fastlane 通过get_version_number获取不到版本号的问题。以下是我的解决方法:

在Gemfile里添加:gem "xcodeproj"

project_version = get_version_number(xcodeproj: "xxxx.xcodeproj", target: "xxxx")
project = Xcodeproj::Project.open('../xxxx.xcodeproj')
target = project.targets.first
if project_version !~ /\d+\./
  target.build_configurations.each do |configuration|
    project_version = configuration.build_settings["MARKETING_VERSION"]
  end
end