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
Related
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 been trying to build my flutter app in iOS simulator but getting build error with following screenshot.
Where my Xcode version is 11.0, CocoaPods version 1.9.3, Flutter version 1.22.0
I have also upgraded connectivity package from 0.4.9+2 to 0.4.9+3 which is latest one. Following some steps by googling but no one is working yet. However my android build is fully ok.
Thanks in advance.
I have solved this issue through running this command in terminal at Project folder directory
rm ios/Podfile && flutter build ios
I solved this problem by setting in the podfile
platform :ios, '12.1'
And then later inserting the same version in Xcode as well
For me, it turned out that I was opening ios/Runner.xcodeproj instead of ios/Runner.xcworkspace.
Opening ios/Runner.xcworkspace from Xcode worked for me!
Alternatively, go to your flutter appname/ios folder and type in commandline:
sudo gem install cocoapods
flutter pub get <---may or may not be necessary for you
pod install
This will install the infuriating cocoapods to your project
If you are working with flavoured build, e.g staging, production, development.
Your app will most likely be running on Runner so click on runner and select the correct build build flavour which in this case would be one of the flavours.
I have this issue and this sequence of steps have worked for me.
Go to the ios folder #cd ios
Delete the Podfile #rm Podfile
Run flutter clean
Run flutter pub get
Case you need generate files with build_runner #flutter packages pub run build_runner build --delete-conflicting-outputs
Build for app for iOS. #flutter build ios
Generate your project pods. #cd ios && pod install
Build project from XCode
In many cases it comes because of difference between Pod install version in flutter and Xcode. Just check them or simply add 'platform :ios, '11.0'' to your podfile in flutter.
rm ios/Podfile && flutter build ios
Change the platform number on Podfile "platform :ios, '12.1" (in XCode: Pick 12.1v.--> Runner > info IOS Deployment Target: 12.1)
Open the flutter ios folder (right-click on ios folder in vs. code and click "Open in Xcode")
Go to Product > Schemes > New Scheme
Select the name of your Cocoapod, then click OK
build again
it's mean som dependencies missing on project. I solved same problem by this step.
cd /YourProject/iOS
rm Podfile
flutter clean On your IDE
flutter pub get
And cd /YourProject/iOS
pod install
in xode clear build and close xcode
and
run this in project folder.
flutter clean && fluttter pub get && cd ios && rm ios/Podfile && cd .. &&flutter build ios
open xcworkspace instead of xcodeproj.
build the project
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
I spent my day trying to fix my problem, I tried every solution I found in other SO posts but unfortunately I can't figure out how to solve my problem.
I try to integrate TouchID inside my react-native project. I downloaded a npm package called "react-native-touch-id" (sounds perfects !). I followed installation guide and I manually linked library to my project.
But when I try to run application I get the following error :
I tried to clean my project :
rm -rf node_modules
yarn cache clean && yarn install
rm -rf ios/Pods/ && pod install
In xCode I even clean the build folder.
About my versions :
RN : 0.57.4
xCode : 10.1
react-native-touch-id : 4.3.0
Here's my Podfile :
def available_pods
pod 'TouchID', :path => "../node_modules/react-native-touch-id"
end
target 'App' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
available_pods
end
I added the .xcodeproj of react-native-touch-id package inside my project's libraries directory and in Build Phases I linked it.
But I still getting the same error again and again ... I don't understand why ... If someone have an idea some help would be really appreciated :)
It appeared the problem was the Podfile. It seems that Podfile use its own Podspec which caused troubles. So I simply delete the TouchId pod declaration from my Podfile, clean and re-install my pods.
Then, I manually linked the library to my xcode workspace. To do that, under your project name, Right Click on Libraries directory => Add files to "your project name" => Add the xcodeproj of the npm's package located inside your node_modules directory.
After that, in your project Build Phases under the Link Binary with Libraries you have to add the npm's package static library (example libTouchID.a in my case).
To be sure you can clean your project and try to rebuild, it should work now.
For information, I kept all of my softwares version I mentionned above.
If it shows react native(missing) in
product->scheme->manage scheme->project name->build
remove the ios folder
react-native eject
cd ios/
pod init
pod install
cd ..
react-native link
cd ios
open *.xcworkspace/
this happens when the react native package is not linked properly to the ios build. The npm link does it.
I have got the following errors after trying multiple answers from the google.
PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-
iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh
cd "/Users/apple/Downloads/FoodSpot 2"
/bin/sh -c /Users/apple/Library/Developer/Xcode/DerivedData/Build/Intermediates/FoodSpot.build/Debug-iphonesimulator/FoodSpotTests.build/Script-36819C3C1B6A30F50091382D.sh
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock.
Run 'pod install' or update your CocoaPods installation.
I have updated and installed many times, but they are of no use.
For me, the reason was missign User-Defined variables in the Build Settings!
Looking into the issue, the Build Phases tries to diff 2 files.
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
Just because of missing PODS_PODFILE_DIR_PATH and PODS_ROOT variables, assumes them as "" so ${PODS_PODFILE_DIR_PATH}/Podfile.lock points to /Podfile.lock and same for the other one.
So it fails in
diff /Podfile.lock and /Manifest.lock
I fixed this by adding 2 User-Defined settings to the Build Settings
PODS_ROOT = ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
After hours of searching this is the only solution that worked for me
For me, it works after the following:
pod deintegrate --verbose
pod install --verbose
Run 'pod install' or update your CocoaPods installation.
You have answer in the error itself !
The error message states that you should update your CocoaPods installation.
You could remove libPods in frameworks and libraries and update Cocoapods using pod install.
Also:
clean and build the project
SO references :
CocoaPods Errors on Project Build
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
I had been searching for hours and I found solutions as follow:
In my case, method 3 works.
Method 1:
choose the target > go to Build Phrases > click Link Binary With Libraries > remove all libPods.a files
open Terminal > direct to your project > run:
pod install
clean and build project
ref.1
Method 2:
open Terminal > direct to your project > run:
pod deintegrate --verbose
pod install --verbose
ref.2
Method 3:
choose the target > go to Build Settings > click "+" sign
add 2 User-Defined Settings: [to the left = to the right]
PODS_ROOT = ${SRCROOT}/Pods
and
PODS_PODFILE_DIR_PATH = ${SRCROOT}/
ref.3
Just go to Build phases and click on [CP]check Pods Manifest.lock.
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
Both PODS_PODFILE_DIR_PATH and POD_ROOT should define in user-Defined in build settings.
POD_ROOT should have correct path to Manifext.lock file and
POD_PODFILE_DIR_PATH should have correct path for Podfile.lock
So Add below in build settings.
PODS_ROOT ---- ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH ---- ${SRCROOT}
The problem is Podfile.lock and Manifest.lock cannot be found by the Check Pods Manifest.lock Script in your targets build phase.
This is usually caused by PODS_PODFILE_DIR_PATH and PODS_ROOT variables not being defined.
Go to build settings tab to define them.
You will need to look for Podfile.lock and Manifest.lock in your project and get the the full paths of their directories. The directory paths will be the values you use for PODS_PODFILE_DIR_PATH and PODS_ROOT.
Deleting the derived data did the trick for me . I deleted by going into the finder itself.
Make changes in the podfile as given below:
Older pod file
target :TargetName, :exclusive => true do
Changed pod file
target 'TargetName' do
I'm pretty sure that you have opened your Projects' workspace which you try to install new Pods. So try out the following (for me this worked):
Clean the project
Close the project
Run pod install
Open the project and try re-building it once more
Problem might have been resolved.
Edit
It turned out my issue was due to a new line at the end of the Manifest.lock that was not present in the PodFile.lock file. Running a diff on the two files highlighted the issue.
Adding a new line to the end of the PodFile.lock file solved it.
Original Answer
None of the answers have worked for me so I have just checked the "For install builds only" under "[CP] Check Pods Manifest. lock" which is found in the build phases tab.
I believe this setting means it will only run that check when archiving, allowing me to continue developing as I don't need to archive the app on my machine.
Use with caution though as it may not be the best solution for everyone.
This happens if cocoa pods don't install or uninstall properly
If you want to install cocoa pods run
pod install
if you you want to uninstall cocoa pods then run command
pod deintegrate
I had the same issue. Turned out the cocoapods version on Manifest.lock was higher than what I had on my mac. I had to do a 'sudo gem install cocoapods', to get the version of the cocoapods upto what was specified on the Manifest.lock file. This fixed the issue and I had no errors on building the project.
Im facing the same issue now and fixed using this command after navigating to project location in terminal.
pod install --repo-update
I fixed this by adding 2 User-Defined settings to the Build Settings
PODS_ROOT = ${SRCROOT}/Pods
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
In my case, I got same error after integrating my other targets. To solve problem I needed to add both targets in Podfile:
abstract_target 'myApp' do
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'SwiftyJSON'
target 'myAppOtherTarget'
end
Make sure you add a "pod install" command line build step, before the Xcode Project build step.
The error is coming from the build phase run script in your Xcode project's target, which is unable to find Podfile.lock. This file is generated by CocoaPods, which must be installed in a build step in your TeamCity project.
My build steps look like:
Command line: bundle install --path .bundle (installs cocoapods local to the project using Gemfile).
Command line: bundle exec pod install --verbose (uses Podfile)
Command line: carthage update --platform iOS (uses Cartfile)
Xcode Project
Command line to build an archive
Command line to upload a build
Hope this helps.
In my case, the errors were occurring on a _Tests target. I didn't need the _Tests target, and so I deleted it. This resolved the error.
If you happen to move your Podfile like i did and face this issue, the solution discussed below may help -
Delete all of the following - Pods folder, xcworkspace
file, podlock file (skip the ones that are not available for subfolders)
delete all steps that has [cp] in it from the build phase tab
repeat step 1 & 2 for all the sub projects that you have in your workspace
open workspace, go into each project and delete framework for pods, and delete the pods folder from each project
close workspace
run pod install
you should now be able to open, build and run the project
I just fixed it by updating the Cocoapod, cause before the error there was log where the warning shows we need to upgrade our cocoapods as the pod files are not supported by the current cocoapod version, So clean the project , upgrade cocoapod then install pod.
1. Clean project
2. sudo gem install cocoapods/gem install cocoapods
3. pod install (optional if your project still shows error)
Note: I found this error for my flutter application in iOS platform
I think you are trying to use your old project pod folder in your current project, you have to copy Manifest.lock file of your current project and replace that file in your old project's pod folder which you added. Manifest.lock file location YourProject->Pods->Manifest.lock
Hope This was helpful. worked for me!
Please check Top Sites - Sandbox Sync iOS for more explanation. I fixed the issue by changing file paths from
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
to
diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null
in Xocde -> "Open Your Project" -> "Select Your Project" -> "Select Your Target" -> Build Phases -> Check Pods Manifest.lock
If not, try changing paths as mentioned above, along with Legacy Build System. To change build system Xcode -> File -> Workspace Settings -> Build System -> Legacy Build System
I hate to say this, but I just removed the pods/ or didn't include them in the project and it built. I don't know if this will have a long-term effect on the project though.
This is presently my .sh build script for ionic5 for ios. It will probably change in the future.
# BUILDING FOR IOS
##################################
#
# MAKE SURE YOU UNPLUG ALL DEVICES!!!!!
#
##################################
ionic cordova platform remove ios
ionic cordova prepare ios
ionic cordova platform add ios
ionic cordova build ios --prod --release --buildFlag="-UseModernBuildSystem=0" --verbose
cd platforms
cd ios
open "MyApp.xcworkspace/"
cd ..
cd ..
It had be plaguing my project, so I thought I'd take them out. I am yet to deploy the project so far though... so who knows.
BigSur 11.1, XCode 12.4 (12D4e)