I am facing an issue with Podfile as below while installing pod in Xcode project.
Invalid
Podfile
file: undefined method `exists?' for File:Class
I did try to update pod version with brew upgrade cocoapods
and also followed below link:
https://dev.to/retyui/fix-a-pod-install-error-undefined-method-exist-for-fileclass-react-native-24ke
But still no fix.
Please guide me what am I doing wrong here.
Below is my 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
Downgrade cocoapods version can fix it. But if you use XCode 14.3++ and want to archive app, you will get issues.
I tried this way and it worked, open this file in your flutter sdk:
flutter/packages/flutter_tools/bin/pod_helper.rb
Then replace
return [] unless File.exists? file_path
to
return [] unless File.exist? file_path
Here is my solution for above problem (Posting if it could be helpful for devs in same situation)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With