/Users/XXX/Desktop/jenkinsWorkspace/workspace/x_iOS/XXX/XXX-Bridging-Header.h:60:9: 'FlutterPluginRegistrant/GeneratedPluginRegistrant.h' file not found
唔,看起来是依赖的 Flutter 模块炸了,去 Flutter 的打包日志看看,找到如下报错:
Build... Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device. Building com.x w s.XXX for device (ios-release)... Warning: CocoaPods installed but not initialized. Skipping pod install. CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side. Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS. For more info, see https://flutter.io/platform-plugins To initialize CocoaPods, run: pod setup once to finalize CocoaPods' installation. Running Xcode build... Xcode build done. 57.4s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED **
噫,pod install 被跳过了?切到打包机执行了 flutter doctor 命令,查看一下是不是 flutter 环境坏掉了:
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, v1.3.8, on Mac OS X 10.14.6 18G95, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [!] iOS toolchain - develop for iOS devices (Xcode 11.1) ✗ CocoaPods installed but not initialized. CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side. Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS. For more info, see https://flutter.io/platform-plugins To initialize CocoaPods, run: pod setup once to finalize CocoaPods' installation. [✓] Android Studio (version 3.2) [!] Connected device ! No devices available
唔,出现了一样的报错,看起来是升级 CocoaPods 导致的异常。按日志的提示我们执行了 pod setup,操作成功! flutter doctor 报错依旧。咦,怎么肥事?经过 一番搜索 发现,CocoaPods 1.8.x 以下在 setup 时初始化的 repo 是 master,而 1.8.x 已经不再是这个了:
但不知道是 flutter 还是 CocoaPods 的问题(可能是因为我们用的 flutter 版本低了,是 1.3.8),打包过程会通过检测旧版本的主 repo 是否存在来判断 CocoaPods 是否已经初始化,所以我们需要先切换到 1.7.5,然后执行 pod setup,再切回 1.8.3 即可,flutter doctor 显示正常,打包也恢复正常了。