無効な `Podfile` ファイル: File:Class の未定義メソッド `exists?' 質問する

無効な `Podfile` ファイル: File:Class の未定義メソッド `exists?' 質問する

Xcode プロジェクトに pod をインストールしているときに、以下のような Podfile の問題が発生しています。

無効なPodfileファイル: File:Class の未定義メソッド「exists?」

私はポッドのバージョンを更新しようとしましたがbrew upgrade cocoapods、以下のリンクもたどりました:

https://dev.to/retyui/fix-a-pod-install-error-undefined-method-exist-for-fileclass-react-native-24ke

しかし、まだ修正されていません。

ここで何が間違っているのか教えてください。

以下は私のPodfileです:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'


flutter_application_path = '../bmi_flutter'
    
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'MixedNativeApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  install_all_flutter_pods(flutter_application_path)
  # Pods for MixedNativeApp

  target 'MixedNativeAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MixedNativeAppUITests' do
    # Pods for testing
  end

end

ベストアンサー1

cocoapods のバージョンをダウングレードすると修正できます。ただし、XCode 14.3++ を使用してアプリをアーカイブする場合は問題が発生します。

この方法を試してみたところ、うまくいきました。Flutter SDK でこのファイルを開いてください:

flutter/packages/flutter_tools/bin/pod_helper.rb

次に交換する

return [] unless File.exists? file_path

return [] unless File.exist? file_path

おすすめ記事