无效的“Podfile”文件:未定义的方法“存在?” 对于文件:类

Gag*_*iOS 19 cocoapods

在 Xcode 项目中安装 pod 时,我遇到如下 Podfile 问题。

无效Podfile文件:未定义方法“存在?” 对于文件:类

brew upgrade cocoapods我确实尝试使用以下链接更新 Pod 版本:

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
Run Code Online (Sandbox Code Playgroud)

Kie*_* Vu 27

降级cocoapods版本可以解决这个问题。但如果您使用 XCode 14.3++ 并想要存档应用程序,则会遇到问题。

我尝试了这种方法并且成功了,在你的 flutter sdk 中打开这个文件:

flutter/packages/flutter_tools/bin/pod_helper.rb
Run Code Online (Sandbox Code Playgroud)

然后更换

return [] unless File.exists? file_path
Run Code Online (Sandbox Code Playgroud)

return [] unless File.exist? file_path
Run Code Online (Sandbox Code Playgroud)


Gag*_*iOS 18

这是我对上述问题的解决方案(发布是否对处于相同情况的开发人员有帮助)

gem cleanup
brew uninstall cocoapods
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.10.0 -n /usr/local/bin   ***`add cocoapod version u want to install`***
sudo gem install cocoapods-user-defined-build-types
pod install --repo-update
Run Code Online (Sandbox Code Playgroud)