xcodebuild exportarchive:"AppStore Profile" 不是 "iOS App Development" 配置文件

xcodebuild exportarchive: "AppStore Profile" is not an "iOS App Development" profile

我正在尝试为 TestFlight 版本构建和导出 IPA。我是 运行 Azure DevOps 托管 Mac 代理上的构建管道,因此我无法使用自动签名。 (这是一个 Flutter 应用程序,但我不确定这是否与我遇到的特定问题相关)这是在我的构建步骤中发生的事情:

  1. 我在构建机器上安装了“iPhone Distribution”证书和“AppStore 配置文件”。 (“AppStore 配置文件”是使用 Apple 开发者门户中的“iPhone Distribution”证书生成的)
  2. 运行 Flutter 发布构建,因此它生成本机 xcode 构建所需的 xcode 项目资源。
  3. 运行 .xcworkspace 上的“xcodebuild archive”命令。在我的“project.pbxproj”中为 PBXNativeTarget 的发布配置指定了以下设置:
CODE_SIGN_IDENTITY= "iPhone Distribution: XXXXX PTY LTD (XXXXXXXXXX)";
PROVISIONING_PROFILE_SPECIFIER = "AppStore Profile";

第 3 步成功 ** ARCHIVE SUCCEEDED **

  1. 运行 带有“-exportOptionsPlist XcodeTaskExportOptions.plist”的“xcodebuild -exportArchive”命令。以下是“XcodeTaskExportOptions.plist”的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
      <key>signingStyle</key>
      <string>manual</string>
      <key>teamID</key>
      <string>XXXXXXXX</string>
      <key>signingCertificate</key>
      <string>iPhone Distribution: XXXXX PTY LTD (XXXXXXXXXX)</string>
      <key>provisioningProfiles</key>
      <dict>
        <key>com.myproj.app</key>
        <string>AppStore Profile</string>
        <key>method</key>
        <string>app-store</string>
      </dict>
  </dict>
</plist>

步骤 4 失败并出现以下错误:

...Error Domain=IDEProfileQualificationErrorDomain Code=3
"Provisioning profile "AppStore Profile" is not an "iOS App Development" profile."
UserInfo={IDEProfileQualification...

出于某种原因,它抱怨我的“AppStore 配置文件”不是“开发”配置文件。显然我正在尝试为 TestFlight 版本创建一个 AppStore IPA,所以我不想使用任何“开发”证书或配置文件。我不知道我在这里做错了什么。感谢对此的任何帮助。谢谢!

好的,我发现错误了。这是因为我在 XcodeTaskExportOptions.plist 中使用了错误的格式。我把关键的“方法”放在了“provisioningProfiles”中。它应该移动到根级别。

更正后的 plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
      <key>signingStyle</key>
      <string>manual</string>
      <key>method</key>
      <string>app-store</string>
      <key>teamID</key>
      <string>XXXXXXXX</string>
      <key>signingCertificate</key>
      <string>iPhone Distribution: XXXXX PTY LTD (XXXXXXXXXX)</string>
      <key>provisioningProfiles</key>
      <dict>
        <key>com.myproj.app</key>
        <string>AppStore Profile</string>
      </dict>
  </dict>
</plist>