ios - 在 Azure Pipelines 中签署 iOS Flutter 应用程序

标签 ios flutter azure-devops azure-pipelines

在 Azure Pipelines 上存档到 ipa 文件时,我无法签署我的 Flutter 项目。

这是我的构建管道设置:

enter image description here

  1. 从 Apple 开发者计划获取和构建证书;
  2. 来自 Apple 开发者计划的配置文件;
  3. Flutter 构建脚本是 this one 的副本(无需签名);
  4. 启动 xcodebuild 存档以获取签名的 ipa。

我尝试了手动签名和自动签名。

手动签名

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace ..../ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: My Name (MYTEAMID) PROVISIONING_PROFILE=guid-of-my-provisioning-profile PROVISIONING_PROFILE_SPECIFIER= | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.blabla.myapp has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')
    error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.blabla.myapp has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')

具有自动签名

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace .../ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=MYTEAMID | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: No profiles for 'com.blabla.myapp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.blabla.myapp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')

具有自动签名和 -allowProvisioningUpdates

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace .../ios/Runner.xcworkspace -scheme Runner archive -allowProvisioningUpdates CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=MYTEAMID | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'Runner' from project 'Runner')
    error: No profiles for 'com.blabla.myapp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.blabla.myapp'. (in target 'Runner' from project 'Runner')

有什么想法吗?首先,我应该使用自动签名还是手动签名?

编辑1

我尝试使用azure-pipelines.yaml发现here我仍然有错误:

Starting: Xcode archive and sign
==============================================================================
Task         : Xcode
Description  : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Version      : 5.151.2
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/xcode
==============================================================================
/usr/bin/xcodebuild -version
Xcode 11.1
Build version 11A1027
/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/runners/2.160.1/work/1/s/ios/Runner.xcworkspace -scheme Runner clean analyze archive -verbose CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: XXXXXX (XXXXXXX) PROVISIONING_PROFILE=dd325087-6f6c-467b-93e2-a8c2446711e3 PROVISIONING_PROFILE_SPECIFIER=
Build settings from command line:
    CODE_SIGN_IDENTITY = iPhone Distribution: XXXXXX (XXXXXXX)
    CODE_SIGN_STYLE = Manual
    PROVISIONING_PROFILE = dd325087-6f6c-467b-93e2-a8c2446711e3
    PROVISIONING_PROFILE_SPECIFIER = 
    SDKROOT = iphoneos13.1

note: Using new build system

** CLEAN SUCCEEDED **

note: Using new build system
note: Planning build
note: Constructing build description
error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')
error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')

** ANALYZE FAILED **

note: Using new build system
note: Planning build
note: Constructing build description
error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')
error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')

** ARCHIVE FAILED **

附注

  • 我可以使用 Xcode 构建和存档 Macbook;
  • 我可以在 AppCenter 上进行构建和存档有了这个script (但我所有其他管道都在 DevOps 上,我想保留一个用于 CI/CD 的工具)。

解决方案

按照 Levi 的建议,我编辑了生成的 Podfile 并强制提交它。

PS:无需更新安装/卸载 cocoapods,Azure Pipelines 上的包今天已是最新版本 1.8.4。

最佳答案

您可以使用 flutter install 任务和 flutter build 而不是运行 bash 脚本。检查一下here .

如果您的项目需要cocoapods,您可能需要添加Cocoapods task到您的管道。请查看example由 Microsoft 提供,用于了解有关如何构建 xcode 应用程序的更多信息。

要解决配置文件未提供资金的错误,您可以检查 carthage 库是否已正确配置到 xcode projet 中。您也可以尝试提供的解决方案here .

更新:

对于 pods-runner 不支持错误,请尝试将以下内容添加到您的 pod 文件中。

  post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
          config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
          config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
      end
    end

并添加以下脚本以在构建之前安装最新版本的cocoapods

    echo "uninstalling all cocoapods versions"
    sudo gem uninstall cocoapods -ax
    echo "installing cocoapods version latest"
    sudo gem install cocoapods --pre

更多信息您可以查看this thread .

关于ios - 在 Azure Pipelines 中签署 iOS Flutter 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59196199/

相关文章:

ios - 如何防止 VoiceOver 自动滚动 UICollectionView?

ios - 来自特定索引路径 SWIFT 的双端自定义单元格

ios - 无法直接打开whatsapp聊天群邀请

azure-devops - "Disconnect"VSTS 中的 fork Git 存储库

ios - XCode 6 beta 7 快速错误

ios - SSL 固定是否适用于 WKWebView

dart - 在 flutter 中使用底部导航栏在页面之间传递数据

android - Flutter:http get 请求在 apk 版本上不起作用

azure - Visual Studio Online - 开发运营

asp.net-core - NETSDK1045 : The current . NET SDK不支持 'newer version'作为目标