你可以用
sudo arch -x86_64 gem install ffi
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
arch -x86_64 pod install //(On an M1 mac use => arch -x86_64 pod install)
cd ..
flutter build ios
flutter run
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 this
pod install --repo-update
After everything is done run your project again
flutter run
Ref:- Running pod install
I got this error when I was using Firebase in flutter, the solution for me was to set the Podfile deployment target to a iOS version higher than 9.
Example: Changed this
#platform :ios, '9.0'
to
platform :ios, '13.0'
I faced the same issue and none of the above work. Finally I resolved it by:
ios/.symlinks/plugins
contains extra plugin which you are not using.podfile.lock
in ios folder, if it exists.podfile
from ios folder.pods
folder in ios directory.flutter clean
in the terminal.flutter pub get
in the terminal.flutter run
in the terminal.2022 update
After struggling for hours the following helped me:
sudo gem uninstall cocoapods
brew install cocoapods
Make sure you have HomeBrew installed before you do the above. Steps to install HomeBrew: Install HomeBrew
/dart/apps/abc
flutter clean && pod update
So did you solve this problem?
I met the same situation. And this is the solution I found. Link
Basically:
After you finish the above several steps, restart your IDE and re-run the application. Please give a reply if this method works.
sudo gem install cocoapods
pod init
It works for me..
For Mac M1, try the following commands. Worked for me fine
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
I'm using VS Code and flutter 2.10.1 running intel mac
I've faced this problem several times, usually when switching between projects or when working with multiple versions of project. But the solution is pretty simple.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
check whatever version you are using on simulator and replace '9.0' with that and uncomment.
# Uncomment this line to define a global platform for your project
platform :ios, '15.4'
pod repo update
And that should solve the problem.
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 .
podfile.lock
(located in app root > ios folder)pod install --repo-update
flutter run
If you have a Mac with Apple Silicon use this method to fix the problem:
Check in ios/.symlinks/plugins for unused plugins. and if there are, remove from pubspec.yml. This solved my problem.
如果您有 MacBook Pro M1,那么此命令会有所帮助(对我有用)
sudo arch -x86_64 gem install ffi
As per the install instructions make sure M1 users run. Solved the issue for me. I missed it on install!
$ sudo softwareupdate --install-rosetta --agree-to-license
run this code on the terminal
sudo arch -x86_64 gem install ffi
Next, go to the ios folder in your project, and open Podfile.
Then change #platform :ios, '9.0'
to platform :ios, '10.0'
I solve the same issue so:
I had similar problems running flutter web on mac. Make sure you uncomment and update the podfile from macos folder not ios I'm talking about these lines:
# Uncomment this line to define a global platform for your project
platform :osx, '15.4'
If you want an automated script to change the deployment target, use
sed -i '' 's/9.0/10.0/' ./.ios/Podfile
where 9.0 is the generated iOS version and 10.0 the desired
on your pipeline, shell script or whatever
The link https://cdn.cocoapods.org does not work correctly, I had to change the source in ios/Podfile
as described in the code below:
ios/Podfile
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
flutter clean
flutter pub get
The error can also come from a package which requires a version higher than '9.0'
in this case it is necessary to uncomment the line # platform:ios, '9.0'
and to pass for example to version '14.0'
according to the version requested by the package.
There are multiple reasons this could occur so a one-size-fits-all solution won't exist.
Instead, in terminal, run:
$ cd ios
$ pod install
This will give you more in depth information on the error and you can search from there. In my case one of my dependencies required a higher minimum ios version so I had to open the.xcworkspace file and adjust the minimum deployment version in xcode>targets>general>minimum_deployments
If anyone is struggling on M1 machines with a particular pod, the following helped me:
flutter precache --ios
arch -x86_64 pod update Firebase/Firestore //or name of pod from the error
For me none of the above helped, the following worked on my case:
macos
folder from main project.dummy flutter project
.macos
folder.main project
. Additionally I use firebase plugins, so I made some changes in pod
file,.. It started running.
Open Your Terminal paste this line of code open ~/.zshrc press Enter
if you don't have the zshrc file you will have to create it, to create it you need to open terminal paste this code touch ~/.zshrc add you flutter path and move to Second instruction
2 The Text File will open add then you add this export LANG=en_US.UTF-8
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.