概要
GitHub ActionsでFlutterアプリをビルドする際、以下のようなエラーが発生してしまいしばらくハマったため、
対処方法を記録します。
CocoaPods could not find compatible versions for pod "cloud_firestore"
(中略)
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
(エラーメッセージでググるとPodfileを書き換える記事がヒットしますが、Flutterではflutter build ios
の過程でPodfileが生成されるため、この方法では対処できないと考えています)
対処方法
自分の場合は手元にMacOSがなくXCode経由で操作ができないため、
ios\Runner.xcodeproj\project.pbxproj
内の IPHONEOS_DEPLOYMENT_TARGET
の値を 9.0 -> 11.0 に変更することで対処しました。
(Profile, Debug, Release用に3か所)
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
この変更を行ったところビルドが通ることを確認できました。
Running "flutter pub get" in flutter_tools... 16.4s
Running "flutter pub get" in strollog... 9.4s
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building *** for device (ios-release)...
Running pod install... 548.6s
Running Xcode build...
Xcode build done. 1145.9s
Built /Users/runner/work/xxxx/xxxx/build/ios/iphoneos/Runner.app.
環境
Flutter: 2.10.1
GitHub Hosted Shared Runner: macOS 11
XCode: /Applications/Xcode_13.2.1.app
参考