按照此处的文章,我刚刚将我的应用设置为在App Center上构建。
尽管Android版本可以在App Center上很好地构建和部署,但iOS生成却出现了错误,如以下构建输出的摘录所示:
==============================================================================
Task : CocoaPods
Description : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
Version : 0.151.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.9.1
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update
[!] Invalid `Podfile` file: Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first.
# from /Users/runner/runners/2.165.2/work/1/s/bdstories/ios/Podfile:51
# -------------------------------------------
# unless File.exist?(generated_xcode_build_settings_path)
> raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
# end
# -------------------------------------------
##[error]The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[section]Finishing: Pod install
##[section]Starting: Xcode build (signed)
我的构建脚本是:
#!/usr/bin/env bash
# Place this script in project/ios/.
# Fail if any command fails.
set -e
# Debug log.
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel beta
flutter doctor
echo "Installed flutter to `pwd`/flutter"
# Build the app.
flutter build ios --release --no-codesign
我确实添加了flutter pub get
错误中提到的,但这并没有什么不同。另外值得注意的是,当我在Xcode本地进行构建时,该构建工作正常。我也可以毫无问题地将生成的存档部署到Testflight。这只是我遇到问题的App Center构建过程。
我现在有点迷茫,找不到有关如何解决此问题的任何信息。我还是CI / CD的新手,所以感谢您的帮助!
更新资料
我还尝试将以下内容添加到脚本中,以强制App Center运行与本地计算机相同版本的Cocoapods,但该错误没有改变。
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.9.1
pod setup
我对我的克隆后脚本执行了此操作,并且有效:
#!/usr/bin/env bash
#Place this script in project/ios/
echo "Uninstalling all CocoaPods versions"
sudo gem uninstall cocoapods --all --executables
COCOAPODS_VER=`sed -n -e 's/^COCOAPODS: \([0-9.]*\)/\1/p' Podfile.lock`
echo "Installing CocoaPods version $COCOAPODS_VER"
sudo gem install cocoapods -v $COCOAPODS_VER
# fail if any command fails
set -e
# debug log
set -x
pod setup
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel master
flutter doctor
flutter pub get
echo "Installed flutter to `pwd`/flutter"
flutter build ios --release --no-codesign
技巧似乎是将“如果任何命令失败会失败”部分移至重新安装Pod之后
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句