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.
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
You can fix it with
sudo arch -x86_64 gem install ffi
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'
And as #Mana commented, remember the higher the version you set, your app will not be supported for users with lower IOS versions
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 runin 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
For Mac M1, try the following commands. Worked for me fine
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
Change directory to your project; e.g /dart/apps/abc
Type, flutter clean && pod update
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'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.
Inside your project parent directory go to, ios -> Podfile. Here the top line will be something like this,
# 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'
Now if we try to run the flutter project, the debugger will say that the cocoapods are outdated. So just update them using command
pod repo update
And that should solve the problem.
Simply delete the Podfile from your project
Run this command in terminal (I did in Android studio terminal it self)
sudo gem install cocoapods
And then run this
pod init
It works for me..
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:
Change source in ios/Podfile
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
Clean your project
flutter clean
Install referenced packages
flutter pub get
Run the app
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.
Delete the podfile.lock (located in app root > ios folder)
Run in Terminal pod install --repo-update
flutter run
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
For me none of the above helped, the following worked on my case:
Deleted the macos folder from main project.
Created a dummy flutter project.
Copied the newly created macos folder.
Pasted it to my main project.
Additionally I use firebase plugins, so I made some changes in pod file,..
It started running.
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.
Check in ios/.symlinks/plugins for unused plugins. and if there are, remove from pubspec.yml. This solved my problem.
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:
Delete podfile.lock in iOS-folder app
Run pod repo update in the terminal
Re-compile my code
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
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
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
Related
Hi I am facing an error on flutter while running my application in iOS simulator only. It works perfectly fine in Android simulator. After I upgraded my firebase dependencies that I added since then I am facing the issue.
The version I was using before are as follow
firebase_auth: ^0.18.3
cloud_firestore: ^0.14.3
firebase_core: ^0.5.2
firebase_crashlytics: ^0.2.4
The version I am using now are as follow
firebase_auth: ^0.20.0
cloud_firestore: ^0.16.0
firebase_core: ^0.7.0
firebase_crashlytics: ^0.4.0
The error I am getting is
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please
specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone 12.
Note this issue is only in iOS and not on Android and I wanted to upgrade the firebase.
I have tried many methods on Stackoverflow and other resources but it seems to be of no help.
This problem occurs because you have not set a minimum ios version in your Podfile.
Set a platform version in your Podfile.
cd ios
nano Podfile
Uncomment this line at the start of the file
# platform :ios, '9.0'
You can set the version to 11.0 if you like as some plugins don't support 9.0 anymore.
After that is done, run the following commands:
rm Podfile.lock
rm -rf Pods
pod install
Additionally, you can update the minimum iOS version for your app in the Runner to the version you set in the Podfile
That should do it for you.
Delete the 2 pod files in the ios folder. run Flutter clean command in the terminal and then try running the app on your iPhone.
This happens to me often and the above method works for me.
I Have tried multiple stuff and failed on doing this
and now I got the perfect solution for MacBook M1 Chip users.
We need to clear all the cache files and update the pods
following the below steps would be the best
Remove the .Pods and .symlinks in the iOS folder inside the flutter
project.
Remove Podfile.lock Remove pubspec.lock
Run Flutter clean
Run Flutter pub get
Change into iOS folder and run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod update
PS: For M1 Users
I upgraded my Xcode to 12. Everything was working perfectly and all of a sudden I kept getting bellow error message (Image below)
SO link have tried using to solve this issue
SO Link
What I've done so far
Cleaned Build Folder
Restarted Xcode
Updated Cocoapods
Deleted DerivedData
Cleared pod cache
Deleted pods directory and file and reinstall
None of them worked and its getting frustrating.
Pod file
All I did was to follow the instruction(see image below) and it got fixed.
Source here
I had the same problem with a project still targeting iOS 8 as the minimum iOS version. This steps solved my problem:
Update minimum target iOS version to iOS 9 on Podfile file;
Open terminal on project folder, remove all pod file dependencies and update them by running:
rm -rf /Pods
pod repo update
pod install
Update minimum project target iOS version to iOS 9;
Remove DerivedData;
Clean project;
Compile/run project again.
A simpler solution is to update cocoapods to the 1.10 version
First, update the CocoaPods installation :
[sudo] gem install cocoapods
Then, update your project : bundle update cocoapods
Finally, run pod install and everything should be OK :)
If the previous solutions did not help someone, then try changing it this way:
#include <nanopb/pb.h>
->
#include "nanopb/pb.h"
This issue CAN be the result of developing iOS on an M1 (Apple Silicon) machine. In this case, the only way to fix the problem is to download a Ruby extension called "ffi" which you can read about here (for extra information): https://rubygems.org/gems/ffi/versions/1.0.9
To do this:
In Terminal, install ffi onto your machine using this command:
sudo arch -x86_64 gem install ffi
Then in your project file, install your podfile with this command:
arch -x86_64 pod install
This should allow you to install your pods (especially if you were getting a "zsh: abort pod install" problem. Notice Terminal will warn you "a bug in the Ruby interpreter or extension libraries".
After this, if your pod was FireStore/FireBase you may have to get another GoogleService-Info.plist file in your project.
I have used several times the Xcode simulator for my flutter app.
One time I tried to change the simulator to iPhone 11 Pro (don't know if it did or did not cause the problem) but since then:
I get the error Module 'path_provider' not found.
It seems that each time when I double click on the Runner.xcworkspace file, it opens the project file instead. I'm new to Xcode so not quite sure about that but I attached a screenshot.
Things I've tried:
updated according to the instructions in the warnings (which can be seen in the screenshot).
deleted all Xcode cache with Reset Xcode
deleted the android studio project and popped it again from git.
flutter clean + removed all the pod files + pod install from android studio terminal.
according to the explanations here: reinstall pod
What else can I do?
I had the same issue. All I had to do was open the runner.xcworkspace instead of runner.xcodeproj and run the app.
I faced this same error and realized that I have used pod init manually so I deleted the Podfile in the ios folder then run flutter build ios.
The Flutter will generate the Podfile correctly and everything works well after that.
The problem for me, as it seems, was that the Xcode opened "Runner.xcodeproj" instead of "Runner.xcworkspace"
from what I understood, .xcworkspace is the one that makes the bindings/connections between files and packages. xcodeproj doesn't do it and that's why it was missin although I did have it.
Solution:
To be sure I do have the updated version of the missing package:
cd [project path]
Flutter clean (or delete the build folder to ensure there is no cache)
cd [project path]/ios
pod install
pod update
Then, when opening the Xcode I clicked:
Project navigator (folder icon on the left toolbar) -> Runner (in the project tree that opened) -> Runner (under Targets)
(shown in the attached picture)
and then when I build it worked for me.
In Podfile, I just comment platform :ios, '11.0', it worked!
I had the same problem that was caused by the linker.
I solved it as follows:
runner->build setting->other linker flags, and delete path_provider
My technique is basically to rip it up and start again - keeping all the lib files though! That way you can keep track of what you need to do to fix the things you broke trying to fix it earlier !
I create a new flutter project and add the lib files from the broken project. then piece by piece put it back together.
I decided on this idea after trawling through many 'patches' to the specific errors that I saw. I should not have been anywhere near those errors - so patching them just broke more - untraceably. Hence the rebuild.
In Flutter project, I Also faced with this issue. Fixed by updating flutter and cocoa pods to the latest version.
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
Move to podfile (project_name/ios/Podfile) and comment platform :ios, '11.0' like this # platform :ios, '11.0'
then run this commands
cd ios
pod install
arch -x86_64 pod install //(On an M1 mac use => arch -x86_64 pod install)
cd ..
flutter run
How to do pod installation? I tried it out but nothing is happening in my swift application.
pod requires active gem version 2.2.2
First of all, gems are ruby script. To install it go to your terminal and type then you would need to provide your password.
sudo gem install cocoapods
after it was installed to your xcode project where you want to add or use the pod , and make sure the xcode project is closed.
so if I wanted to go my project in the desktop in the terminal
cd Desktop && cd name_of_project
Then now type:
pod init
then you open the pod file
open Podfile (it will open inside of a text editor)
now remove the # in front of platform :ios, '8.0' and use_frameworks
In between the
target "name_of project" do
// place the source and the pod
end
save the file then go back to the same terminal and type:
pod install
wait until it finished then go your xcode (not to your terminal) project then open .xcworkspace everytime you want to access your project
You need CocoaPods to be installed in your system.
Go to Console,
and type:
sudo gem install cocoapods --verbose
If you get any warning(s)/error(s) then, please update the question with the log showing ther warning(s)/error(s).
Kind Regards,
Suman Adhikari
For me I down graded the pod to an earlier version and then it worked perfectly well.
I'm quite New to ios and cocoapods.
I am using realm.io swift version. Everything is latest version including xcode, realm and cocoapods
I did it with dynamic linking and realised itunes don't accept the strips framework.sh ...so I try using cocoapods. I didn't remove the dynamic linking and followed the steps using cocoapods to install realm.
It generated the workspace file for me and the running keeps telling realm object can't be found though I have import realm.
So I decided to remove the previous dynamic linking and install cocoapods to start all over again.
Now cocoapods don't generate workspace for me.even a new project that I created.
I tried all the comments to remove pod, cocoapod and even clone the cocoapods etc but nothing works
Please help. Why it don't generate workspace for me anymore
I followed these steps but still don't work
https://teamtreehouse.com/forum/pod-install-error-in-terminal-not-creating-xcode-workspace
Just copying from the comments: the answer was to specify use_frameworks! to the test target.
I was getting an Abort:6 error during the Generating Pods project step of pod install.
I deleted the Pods folder, reinstalled Cocoapods, ran pod install again, and it worked.
Reinstall cocoapods:
sudo gem uninstall cocoapods
sudo gem install cocoapods
I used all of the given solution and get success.
First got to Product->Scheme->ManageScheme and then check the shared box(Selected Form)
now pod install
if problem still arise
Try this
pod setup
pod install
if still have problem.(this worked for me)
rm -rf ~/.cocoapods
pod setup
pod install
if problem still there then last but not least
rm -rf ~/.cocoapods
git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master
pod install
If you've done all the above steps and if it's still not working, try
pod install --repo-update
I tried all the above steps, and still it was generating pod folders with blank dependency names. This step should download all the required dependencies for your project and will also create the .xcworkspace
To generate a workspace you must have the installer line in your Podfile saying:
integrate_targets => true
like this:
install! 'cocoapods', :integrate_targets => true
If you are using frameworks you do not need the workspace generated.
Try adding
use_frameworks!
between the platform line and the target line, then redo pod install from your terminal.
I did
rm -rf ~/.cocoapods/repos/trunk/
After that it worked again.