简体   繁体   中英

How to handle multiple iOS targets (widgets) in fastlane

I'm trying to add widgets to our project and fastlane isn't able to automate anymore.

  • How do I edit the widget bundle identifier in fastlane
  • How do I set the right provisioning profile for the right target

Things I need:

  • in xcode the app target should have bundle identifier xyz
  • in xcode the widget target should have the bundle identifier xyzwidget

app target在此处输入图片说明 widget target在此处输入图片说明

  • in xcode the app target should have provisioning profile match adhoc xyz
  • in xcode the widget target should have provisioning profile match adhoc xyzwidget

app target signing在此处输入图片说明 widget target signing在此处输入图片说明

current Fastfile lane:

  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}" }
    })

You can add one more key for widget in export_options->provisioningProfiles for specifying provisioning profile of widget.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM