【问题标题】:Error: "Version could not be created from build. Please make sure that your .ipa file has the correct format"错误:“无法从构建中创建版本。请确保您的 .ipa 文件具有正确的格式”
【发布时间】:2019-10-28 08:31:13
【问题描述】:

应用程序的 Android 版本一切正常。我使用 VS 代码使用 Flutter 开发应用程序,然后使用 Azure DevOps 构建它,最后我将其发布到 AppCenter。

相对于Android,IOS不创建IPA文件,只构建一个Runner.app。因此,在 Azure DevOps 中,我使用以下代码构建应用程序:

trigger:
- master

pool:
  vmImage: 'macos-latest'

steps:

- task: CocoaPods@0
  inputs:
    workingDirectory: './ios'
    forceRepoUpdate: false
- task: MobileDevOpsKeychanger@0
  inputs:
    KeyChangerPassword: '$(keychangerpw)'
    DoAndroidSigning: false
    DoAppleDistribution: true
    AppleAppIdDistribution: '[myBundleID]'
    DoAppleEnterprise: false

- task: FlutterInstall@0
  inputs:
    channel: 'beta'
    version: 'latest'

- task: FlutterBuild@0
  inputs:
    target: 'ios'
    projectDirectory: '.'
    iosCodesign: false

- task: CmdLine@2
  inputs:
    script: |
      mkdir -p Payload
        mv ./build/ios/iphoneos/Runner.app Payload
      zip -r -y Payload.zip Payload/Runner.app
        mv Payload.zip Payload.ipa
      rm -Rf Payload
- task: CopyFiles@2
  inputs:
    Contents: '**/*.ipa'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

但不幸的是,当我对 IOS 执行相同操作时,我得到了这个 错误

6851704Z ##[error]"{\"status\":\"error\",\"message\":\"无法从构建创建版本。请确保您的 .ipa 文件格式正确。\"}" http响应码:422

Azure DevOps

【问题讨论】:

  • 可以参考类似的issue1,issue2看看有没有帮助。

标签: ios flutter azure-devops code-signing azure-pipelines-release-pipeline


【解决方案1】:

解决方案已在https://github.com/flutter/flutter/issues/13065中提及

首先我必须使用

将 Runner.app 转换为 ipa
xcodebuild -workspace Runner.xcworkspace -scheme Runner -sdk iphoneos -configuration Release archive -archivePath $PWD/build/Runner.xcarchive
xcodebuild -exportArchive -archivePath $PWD/build/Runner.xcarchive -exportOptionsPlist exportOptions.plist  -exportPath $PWD/build/Runner.ipa

并在 ios 目录下创建文件 exportOptions.plist。

【讨论】:

  • 感谢您在这里分享您的解决方案,您可以 Accept it as an Answer ,这样它可以帮助遇到相同问题的其他社区成员,我们可以归档这个帖子,谢谢。
猜你喜欢
  • 2014-09-20
  • 2021-05-29
  • 2016-11-18
  • 1970-01-01
  • 1970-01-01
  • 2011-11-10
  • 2015-01-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多