😇

Flutterで build したら `Signing certificate is invalid.`と出て一生進まない

2023/09/14に公開

とにかくFlutterでbuildできない

Flutter初学者はじめました。
ということでFlutterで色々作ってみて実機でテストなどをしていましたが、いざ Firebase App Distribution で配信テストをしてみようとしたところ掲題エラーを吐いてしまいました。

xcodeのsigning & capabilitiesは設定されている

証明書?エラーらしいのでxcodeで signing & capabilities を確認してみましたが、teamはしっかり設定されていました。

全然お作法がわからない...

何はともあれ一旦clean up

$ flutter clean
$ flutter pub get
$ cd ios
$ pod install && pod update

なんか途中でwarningが...

pod install(update)の際に注意文らしきものが...
(実は前から出てたけど意味がわからずずっと無視してた)

$ pod install

...
[!] Automatically assigning platform `iOS` with version `12.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`.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).

うまくいってないとき、こういう細かい何かを無視するといいことがありません、FIXしましょう。

参考: Flutter: CocoaPodからパッケージをインストールする際に起きたエラーの対処 - Qiita

Automatically assigning platform iOS with version 12.0 on target Runner because no platform was specified...

ちょっと調べたらわかることでしたが、どうやらFlutterのプロジェクト開始時点(flutter create)では対象となるiosのバージョンが指定されていないらしい。
場合によっては外部のライブラリなどが古いiosのバージョンに対応しておらずエラーになる場合もあるらしい。

特にiosバージョンにこだわりもないので、12あたりを指定してみたいと思います。

[ios/Podfile]

# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
platform :ios, '12.0'

CocoaPods did not set the base configuration of your project because your project already has a custom config set...

flutter側でcocoapodsの設定ファイル?(.xcconfig)を参照できるようにする必要があるそう。

[ios/Flutter/Release.xcconfig]

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
↓追記
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"

1行目と追記内容が同じ内容に見えますが、 #include 部分に ? がついているのとついていないので区別されてる?
正直よくわかりませんが、これでFIXできたので詳細は別途調べます...

error: exportArchive: No signing certificate "iOS Distribution" found...

で、形は違えど署名に関するエラーがまた出ました。

エラーの一番下にビルドアーカイブのpathが表記されており、確認したらなんのことはない 上納金を払え というアレでした。

なんやねん

Discussion