fastlane 安装使用

brew install fastlane
安装fastlane

进入iOS项目根目录
fastlane init

fastfile文件

# fastlane/Fastfile
default_platform(:ios)



platform :ios do
  desc "打包并上传到 App Store"
  lane :release do
    # 1. 更新版本号
    increment_version_number(
      version_number: "1.0.0"  # 设置版本号
    )
    
    # 2. 更新构建号
    increment_build_number(
      build_number: "1"  # 设置构建号
    )
    
    # 3. 获取证书和描述文件
    # match(
    #   type: "appstore",
    #   readonly: true
    # )
    
    # 4. 构建应用
    build_app(
      scheme: "Runner",  # 替换为您的 scheme 名称
      export_method: "app-store",
      export_options: {
        method: "app-store",
        provisioningProfiles: { 
          "com.bydauto.f-dealer" => "FDealer_AppStore"  # 替换为您的 Bundle ID 和描述文件名称
        },
          signingStyle: "manual",  # 使用本地证书
        signingCertificate: "fd_dis.p12"  # 证书名称
      }
    )
    
    # 5. 上传到 App Store Connect
    upload_to_app_store(
      skip_screenshots: true,
      skip_metadata: true
    )
  end

  desc "打包测试版本"
  lane :beta do
    # 1. 更新构建号
    increment_build_number(
      build_number: "1"
    )
    
    # 2. 获取证书和描述文件
    # match(
    #   type: "adhoc",
    #   readonly: true
    # )
    
    # 3. 构建应用
    build_app(
      scheme: "Runner",
      export_method: "development",
      export_options: {
        method: "development",
        provisioningProfiles: { 
          "com.bydauto.f-dealer" => "FDealer_Develop" 
        },
    signingStyle: "manual",  # 使用本地证书
        signingCertificate: "fd.p12"  # 证书名称
      }
    )
    
    # 4. 上传到 TestFlight
    upload_to_testflight
  end
end

appfile文件

app_identifier "com.bydauto.f-dealer" # The bundle identifier of your app
apple_id "ipdappstore@byd.com" # Your Apple Developer Portal username
team_id "9YWJ3PZHZG"                      # 开发者团队 ID
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容