xcode Fastlane无法检测到iOS App Development配置文件

pvabu6sv  于 7个月前  发布在  iOS
关注(0)|答案(1)|浏览(89)

我正在使用Fastlane脚本来设置使用CI/CD的自动ios构建。在构建期间,Fastlane无法检测到开发配置文件。我收到以下错误

错误:找不到“my-app-identifier”的配置文件:Xcode找不到任何与“my-app-identifie”匹配的iOS App Development配置文件。自动签名已禁用,无法生成配置文件。要启用自动签名,请将-allowProvisioningUpdates传递到xcodebuild。(在项目“App-scheme”的目标“My-target”中)

默认情况下,在Xcode的自动设置代码签名是启用的,并试图禁用它。并选择证书后,我能够建立与Fastlane的iOS应用程序。
我已经提供了build_app函数的配置文件详细信息。是否可以通过Fastlane选择配置文件?

快速文件

default_platform(:ios)

platform :ios do
  before_all do |lane, options|
    APP_ID=ENV['APP_ID']
    APP_SCHEME=ENV['APP_SCHEME']
    setup_ci
  end

  desc "Fetches the provisioning profiles so you can build locally and deploy to your device"
  lane :certs do
    match(app_identifier: [APP_ID], type: "appstore", readonly: true, git_branch: "new-2")
    match(app_identifier: [APP_ID], type: "development", readonly: true, git_branch: "new-2")
    match(app_identifier: [APP_ID], type: "adhoc", readonly: true, git_branch: "new-2")
  end


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

    # increment_build_number
    connect_appstore_api
    build_app(
      scheme: APP_SCHEME,
      export_method: "app-store",
      output_directory: "./build/appstore/",
      clean: true,
      archive_path: "./build/build",
      export_options: {
        provisioningProfiles: {
          APP_ID => "match AppStore #{APP_ID}",
        }
      }
    )
    # pilot
  end

  desc "Generate certificates"
  lane :generate_certs do
    connect_appstore_api
    match(
      app_identifier: [APP_ID],
      type: "development",
      readonly: false,
      git_branch: "new-2"
    )
    match(
      app_identifier: [APP_ID],
      type: "adhoc", 
      readonly: false, 
      git_branch: "new-2"
    )

    match(
      app_identifier: [APP_ID], 
      type: "appstore",
      readonly: false, 
      git_branch: "new-2"
    )
  end

  private_lane :connect_appstore_api do
    app_store_connect_api_key(
      duration: 1200, # optional (maximum 1200)
      in_house: false,
      is_key_content_base64: true
    )
  end

  lane :check_ci do
    if is_ci
      puts "I'm a computer"
    else
      puts "Hi Human!"
    end
  end

end

字符串

9jyewag0

9jyewag01#

我一直在和同样的问题斗争一段时间。我在gitactions上使用fastlane和nativescript。我终于成功地让构建的归档阶段工作了。
1.确保你有setup_ci(文档)在你的车道你跑。我不知何故错过了这部分的文档。这将整理你的钥匙链等。上面的Fastfile确实有setup_ci
1.请确保您使用app_store_connect_api_key(docs)进行匹配以进行身份验证,因为2FA在ci/cd中不起作用。虽然我已经设置了这个,但我实际上没有运行该命令,并且匹配使用我的应用程序密码然后询问安全代码。上面的Fastfile使用了connect_appstore_api,我在docs中找不到。
1.通过使用update_code_signing_settings(docs)禁用自动代码签名。在构建之前运行此命令,例如在build_app之前。尽管上面的错误说,我真的很难让任何东西在启用代码签名的情况下工作。在调用此函数时,您还应该包括您的profile_name,因为它会告诉xcode使用什么配置文件。下面是一个示例,

update_code_signing_settings(
    use_automatic_signing: false,
    path: "./platforms/ios/nativescript.xcodeproj",
    team_id: "YOUR-TEAM-ID",
    profile_name: "match AppStore YOUR.BUNDLE.ID",
)

字符串
注意profile_name。如果你运行fastlane match appstore,你会看到用于appstore分发的配置文件。我想它看起来会像我在例子中看到的那样,但只是为了确保命令会告诉你你的profile_name参数应该是什么。
1.在本地测试你的构建。如果没有setup_ci,但有了应用商店API、匹配、禁用代码签名和指定配置文件,一切都应该在本地构建。如果没有,检查错误并进行必要的更改。例如,我不得不更改我的build.xcconfig以包含CODE_SIGN_IDENTITY,以显式地告诉excode要使用什么idendity,

CODE_SIGN_IDENTITY = Apple Distribution: APP STORE ACCOUNT (TEAMID)


您可以使用fastlane match appstore来获取此标识。它将被称为“证书名称”
我现在可以很好地构建应用程序。我的新问题是它看起来不像是自动递增构建号,所以应用程序商店拒绝应用程序。这可能与关闭代码签名有关... brb...

相关问题