错误:“无法从内部版本创建版本。请确保您的.ipa文件具有正确的格式”

时间:2019-10-28 08:31:13

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

一切都适用于该应用程序的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 ## [错误]“ {\”状态\“:\”错误\“,\”消息\“:\”无法从版本创建版本。请确保您的.ipa文件格式正确。\“}”       http响应代码:422

Azure DevOps

1 个答案:

答案 0 :(得分:0)

该解决方案已在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。