VS flutter项目 + IOS + fastlane

1. 创建项目

command + shift + P

步骤: 运行以上命令 => Flutter: New Project => Application (若要退出则按键 esc)

2. Fastlane

2.1 gem权限获取

sudo chown -R $(whoami) /usr/local/lib/ruby/gems

2.2 fastlane init

2.2.1 执行命令

这里我们选择 4 Manual setup – manually setup your project to automate your tasks, 之后一直回车即可

2.2.2 配置fastlane Appfile

文件位置: ios/fastlane/Appfile

app_identifier "com.xxx.xxx"
apple_id "xxxx@xxx.com" // appID账号
team_id "27XXXXXXT7"

2.3 fastlane match init

2.3.1 执行命令

2.3.2 修改Matchfile

文件位置: ios/fastlane/Matchfile

git_url("git@xxx.xxx.xxx.xxx:/git/repo/app_cert_pro.git")

storage_mode("git")

type("development") # The default type, can be: appstore, adhoc, enterprise or development

app_identifier(["com.xxx.xxx"])

2.3.3 生成证书

fastlane match development
fastlane match adhoc
fastlane match appstore

2.4 构建fastfile脚本

文件位置: ios/fastlane/Fastfile

default_platform(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
end

default_platform(:ios)

APP_NAME = "Poetry"
IPA_FILENAME = "Poetry.ipa"

platform :ios do
  # Ensure cocoapods is installed before any lanes
  before_all do
    cocoapods
  end

  # Debug package
  lane :iosDebug do
    package(configuration: "Debug", method: "development")
  end

  # Release package
  lane :iosRelease do
    package(configuration: "Release", method: "ad-hoc")
  end

  # App Store package
  lane :iosAppStore do
    package(configuration: "Release", method: "app-store")
  end

  # Packaging function
  lane :package do |options|
    # Build the app
    gym(
      scheme: APP_NAME,
      output_name: IPA_FILENAME,
      export_method: options[:method],
      configuration: options[:configuration],
      include_symbols: true,
      include_bitcode: false,
      export_xcargs: "-allowProvisioningUpdates"
    )
  end
end

2.5 修改Gemfile

添加以下代码:

gem "cocoapods"

2.6 修改Podfile

增加版本描述

platform :ios, '12.0'

2.7 xcode配置修改

修改bundle identifier

修改scheme

2.8 生成IOS ipa文件

bundle exec fastlane ios iosDebug

0 评论
最新
最旧 最多投票
内联反馈
查看所有评论
滚动至顶部