簡體   English   中英

如何在 fastlane 中處理多個 iOS 目標(小部件)

[英]How to handle multiple iOS targets (widgets) in fastlane

我正在嘗試向我們的項目添加小部件,而 fastlane 無法再自動化了。

  • 如何在 fastlane 中編輯小部件包標識符
  • 如何為正確的目標設置正確的配置文件

我需要的東西:

  • 在 xcode 中,應用程序目標應具有包標識符 xyz
  • 在 xcode 中,小部件目標應該具有包標識符 xyzwidget

應用目標在此處輸入圖片說明 小部件目標在此處輸入圖片說明

  • 在 xcode 中,應用程序目標應該具有與 adhoc xyz 匹配的配置文件
  • 在 xcode 中,小部件目標應該具有與 adhoc xyzwidget 匹配的配置文件

應用目標簽名在此處輸入圖片說明 小部件目標簽名在此處輸入圖片說明

當前 Fastfile 通道:

  desc "Build the app and send it to Testflight for testing"
  lane :build_adhoc do
    UI.message("app_name: #{app_name}")
    UI.message("app_identifier: #{app_identifier}")
    UI.message("apple_id: #{apple_id}")
    UI.message("team_id: #{team_id}")
    UI.message("sku: #{sku}")

    xcodeprojpath = "../ios/" + app_name + ".xcodeproj"

    proj = Xcodeproj::Project.open("../" + xcodeprojpath)

    proj.build_configurations.each do |item|
      item.build_settings["DEVELOPMENT_TEAM"] = team_id
      item.build_settings["PROVISIONING_PROFILE_SPECIFIER"] = match_ad_hoc_provisioning
      item.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = match_ad_hoc_signing
      item.build_settings["SWIFT_VERSION"] = swift_version
      item.build_settings["ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES"] = "YES"
    end

    proj.recreate_user_schemes
    proj.save

    begin
      disable_automatic_code_signing
    rescue => ex
      UI.message("failed to disable automatic signing")
      UI.error(ex)
    end
    get_certificates(
      development: false,
      username: apple_id,
      team_id: team_id,
    )
    unlock_keychain(
      password: keychainPassword,
    )

    #bumpBuildNumber

    sigh(username: apple_id, adhoc: true, readonly: false, app_identifier: app_identifier, team_id: team_id)  #force: false,
    gym(export_method: "ad-hoc",
        clean: true,
        configuration: "Release",
        codesigning_identity: match_ad_hoc_signing,
        export_team_id: team_id,
        skip_profile_detection: true,
        export_options: {
          method: "ad-hoc",
          signingStyle: "manual",
          provisioningProfiles: { "#{app_identifier}": "#{match_ad_hoc_provisioning}" },
        })
  end
gym(export_method: "ad-hoc",
    clean: true,
    configuration: "Release",
    codesigning_identity: match_ad_hoc_signing,
    export_team_id: team_id,
    skip_profile_detection: true,
    export_options: {
      method: "ad-hoc",
      signingStyle: "manual",
      provisioningProfiles: { "#{app_identifier}": "#{match_ad_hoc_provisioning}" },                                                   
                            { "#{widget_identifier}": "#{match_ad_hoc_provisioning_for_widget}" }
    })

您可以在export_options->provisioningProfiles 中為widget 添加一個key,用於指定widget 的provisioning profile。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM