I have an error when I tried to launch my project on my iPhone, the basic Flutter example is working on my iPhone but when I use my project I have this error.
10 Answers
This happens when we change any plugins versions or flutter pub package.
I was getting a similar error, so I used many different things but still nothing happened but finally I got an exact solution For the solution follow the below steps
Delete the
podfile.lock
file from the ios folder.Open the terminal, go to the ios folder directory and run
pod install
. It could take some time to install.If
pod install
gives any error then try thispod install --repo-update
After everything is done run your project again
flutter run
Ref:- Running pod install
I faced the same issue and none of the above work. Finally I resolved it by:
- Check
ios/.symlinks/plugins
contains extra plugin which you are not using. - Delete
podfile.lock
in ios folder, if it exists. - Delete
podfile
from ios folder. - Delete
pods
folder in ios directory. - Run
flutter clean
in the terminal. - Run
flutter pub get
in the terminal. - Run
flutter run
in the terminal.
In Flutter project, I Also faced with this issue. Fixed by updating flutter and cocoa pods to the latest version.
Solution:-
- flutter clean
- rm -Rf ios/Pods
- rm -Rf ios/.symlinks
- rm -Rf ios/Flutter/Flutter.framework
- rm -Rf ios/Flutter/Flutter.podspec
- flutter pub get
- cd ios
- pod install
- cd ..
- flutter build ios
- flutter run
So did you solve this problem?
I met the same situation. And this is the solution I found. Link
Basically:
- Locate Terminal.app in Finder. (Applications->Terminal.app)
- Right-click and choose Get Info
- Check the “Open using Rosetta”
- Quit all instances of Terminal app and run it again
- Run sudo gem install ffi
After you finish the above several steps, restart your IDE and re-run the application. Please give a reply if this method works.
I'd the same problem, in my case when I ran pod install --verbose
I realize that there was an specific error during pod install
undefined method `each_child' for #Dir:0x00007ff10befa7f0 Did you mean? each_slice
Looking for this specific error I found this answer and I realize that I was using ruby 2.5 and one file generated by Flutter for iOS devices was trying to use a method that was introduced on version 2.6.
After follow the steps on that answer I could run my Flutter app on iOS simulator.
The method
dir.each_child
was introduced in Ruby 2.6, but you are using Ruby 2.3.0.
You should update Ruby to 2.6.0 or later 2.x version.
After Ruby updating you may also need to restart your IDE and re-install cocoapods.