📚

`post_install` hooks is unsupported..

2025/02/18に公開

Flutter初学者です。
今回はiOSビルドをした際に見たことないPodfileのエラーに直面しました。

エラー内容

[!] Invalid `Podfile` file: [!] Specifying multiple `post_install` hooks is unsupported..

Podfileで「Specifying multiple post_install hooks is unsupported」というエラーが出ている場合、Podfile内に複数のpost_installフックが定義されていることが原因。post_installフックは1つのPodfile内で1回だけ定義する必要があります。

以下の手順でPodfileの修正をしましょう。

1、Podfileを開く

・プロジェクトのPodfileをテキストエディタで開きます。

2、post_installフックを統合する:

・複数のpost_installフックがある場合、それらを1つにまとめます。

post_install do |installer|
  # 1つ目のpost_installの内容
  installer.pods_project.targets.each do |target|
    # 例: iOS 8以上をターゲットにする
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
    end
  end

  # 2つ目のpost_installの内容をここに統合
  # 例: フレームワークの設定
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

3、pod installを再実行:

・Podfileを保存した後、ターミナルでpod installを再実行。

Discussion