Related
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
I am trying to link the #segment/analytics-react-native library in my iOs react-native project.
I followed these two steps given in their docs.
yarn add #segment/analytics-react-native
yarn react-native link
However the yarn react-native link step doesn't seem to work, as all it does is add a pod in the podfile, and modify some android project files that I don't need.
The project.pbxproj file is showed as modified but when I inspect it inside vs code, the only thing it does in that file is removing a line.
Please explain why is this happening
From the docs about linking
If your iOS project is using CocoaPods (contains Podfile) and linked
library has podspec file, then react-native link will link library
using Podfile.
This means that it will not add the dependencies inside your Xcode project.
If you are happy with this then make sure you cd into you iOS folder and run pod install
If you don’t want it installed via CocoaPods then you can either install it manually using the instructions on the dependencies repo (remembering to delete the line added to your pod file); or you can rename your podfile, run react-native link so it adds the files without the updating the podfile, then rename the podfile back to what it should be.
One further point to note you shouldn’t run react-native link without the dependency name. You should run react-native link <dependency name>. You can end up with duplicate entries and unforeseen issue if you don’t.
Getting this error while building a react-native iOS app on xcode.
Started getting this error after npm install and rpm linking react-native-fs library. But after searching online for a solution, I noticed that many people are getting the same error while installing other react native libraries.
A possible solution suggested by many is,
Adding the following under "Build Settings" -> "Header Search Paths".
$(SRCROOT)/../node_modules/react-native/React - (Recursive)
But no luck with this solution, still getting the same error
In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOS (solution was found here: Reliable build on ^0.39.2 fails when upgrading to ^0.40.0).
What happened was that Xcode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.
The solution in my case was to:
Disable the parallel builds:
Xcode menu -> Product -> Scheme -> Manage Shemes...
Double click on your application
Build tab -> uncheck Parallelize Build
Add react as a project dependecy
Xcode Project Navigator -> drag React.xcodeproj from Libraries to root tree
Build Phases Tab -> Target Dependencies -> + -> add React
Make sure you disable Parallelise Build and add React target above your target
QUICK FIX (not the best)
Change the import react-native header lines:
#import <React/RCTBridgeModule.h>
#import <React/RCTLog.h>
To:
#import "RCTBridgeModule.h"
#import "RCTLog.h"
Here is an example of changes I had to make for the library I was trying to use: Closes #46 - 'RCTBridgeModule.h' file not found.
Change
#import "RCTBridgeModule.h"
to
#import "React/RCTBridgeModule.h"
For me, this error occurred when I added a new scheme/target (app.staging) in the app and installed pods using pod install.
This issue is occurring due to pods are not shared for all targets. So I need to add newly added target (app.staging) inside the Podfile.
Here is my Podfile.
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
target 'app' do
# Pods for app
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
target 'appTests' do
inherit! :search_paths
# Pods for testing
end
# Pods for staging app // important line below
target 'app.staging'
use_native_modules!
end
For viewers who got this error after upgrading React Native to 0.40+, you may need to run react-native upgrade on the command line.
If Libraries/React.xcodeproj are red in xcode then reinstall node_modules
rm -rf node_modules && yarn
My newly created project from react-native 0.46.3 was red :S I have npm 5.3.0 and yarn 0.24.5 when I did react-native init
I ran into this issue after doing a manual react-native link of a dependency which didn't support auto link on RN 0.59+
The solution was to select the xcodeproj file under the Libraries folder in Xcode and then in Build Settings, change Header Search Paths to add these two (recursive):
$(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core
$(SRCROOT)/../../../ios/Pods/Headers/Public
My solution was to remove everything in Libraries like described here
Latest releases of react-native libraries as explained in previous posts and here have breaking compatibility changes. If you do not plan to upgrade to react-native 0.40+ yet you can force install previous version of the library, for example with react-native-fs:
npm install --save -E react-native-fs#1.5.1
I was able to build a debug, but I was unable to build an archive.
I solved this issue by dragging React.xcodeproj found in /node_modules/react-native/React to my root directory in Xcode, then added React as a target dependancy in build phases > target dependencies.
After React Native 0.60 this issue is often caused by a linked library mixed with the new 'auto-linking' feature. This fixes it for me
Unlink old library using
$ react-native unlink react-native-fs
Refresh Pods integration entirely using
$ pod deintegrate && pod install
Now reload your workspace and do a clean build.
I receive this error in any new module I create with create-react-native-module. None of the posted solutions worked for me.
What worked for me was first making sure to run yarn in the newly created module folder in order to create node_modules/ (this step is probably obvious). Then, in XCode, select Product -> Scheme -> React instead of the default selection of MyModuleName.
This error appeared for me after I ran pod install command for the new dependencies. Along with those, React had also been installed. Therefore probably Xcode was confused for path. I removed these lines from PodFile and error was gone. Please note that those removed from here were already linked in Xcode.
target 'app' do
pod 'GoogleMaps'
pod 'Firebase/Auth', '~> 6.3.0'
pod 'Firebase/Database', '~> 6.3.0'
# Removed four pods below and it worked.
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
pod 'RNFS', :path => '../node_modules/react-native-fs'
end
Go to iOS folder in your project and install pod -
$ pod install
If you are getting any error in installation of pod type command-
$ xcode-select -p
Result should be - /Applications/Xcode.app/Contents/Developer
If the path is incorrect then open your iOS project in Xcode and go to: Xcode->preferences->command line tools-> select Xcode
And again install the pod your issue will be fixed.
anhdevit's suggestion in https://github.com/facebook/react-native/issues/24363#issuecomment-488547280 worked for me:
In your terminal, run:
defaults delete com.apple.dt.Xcode
delete the pods folder and the .xcworkspace file
run pod install again in that directory
try to archive again and done
If you want to make it from your editor also open SMobile.xcscheme
And change parallelizeBuildables = "NO"
For me didn't work any from the above solutions and below it is what worked (I had already checked out Parallelize Build and added React)
1. Open XCode --> To Libraries add `$LibraryWhichDoesNotWork.xcodeproj$`
2. Then for your app in the `Build Phases` add to the `Link Binary with Libraries` the file `lib$LibraryWhichDoesNotWork$.a`
I've encountered this issue while upgrading from 0.58.4 to new react-native version 0.60.4. Nothing from what i found on the internet helped me, but I managed to get it working:
Go to build settings, search for 'Header search paths', select the entry, press DELETE button.
I had these values overriden, and looks like they fell back to defaults after deletion. Also Cocoapods was complaining about it with messages in Terminal after pod install:
[!] The `app [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-app/Pods-app.release.xcconfig'. This can lead to problems with the CocoaPods installation
If you want to keep Parallelise Build enabled and avoid the missing header problems, then provide a pre-build step in your scheme to put the react headers into the derived-data area. Notice the build settings are coming from the React project in this case. Yes it's not a thing of beauty but it gets the job done and also shaves a lot of time off the builds. The prebuild step output ends up in prebuild.log. The exact headers you'll need to copy over will depend on your project react-native dependencies, but you'll get the jist from this.
Get the derived data directory from the environment variables and copy the required react headers over.
#build_prestep.sh (chmod a+x)
derived_root=$(echo $SHARED_DERIVED_FILE_DIR|sed 's/DerivedSources//1')
react_base_headers=$(echo $PROJECT_FILE_PATH|sed 's#React.xcodeproj#Base/#1')
react_view_headers=$(echo $PROJECT_FILE_PATH|sed 's#React.xcodeproj#Views/#1')
react_modules_head=$(echo $PROJECT_FILE_PATH|sed 's#React.xcodeproj#Modules/#1')
react_netw_headers=$(echo $PROJECT_FILE_PATH|sed 's#React/React.xcodeproj#Libraries/Network/#1')
react_image_header=$(echo $PROJECT_FILE_PATH|sed 's#React/React.xcodeproj#Libraries/Image/#1')
echo derived root = ${derived_root}
echo react headers = ${react_base_headers}
mkdir -p ${derived_root}include/React/
find "${react_base_headers}" -type f -iname "*.h" -exec cp {} "${derived_root}include/React/" \;
find "${react_view_headers}" -type f -iname "*.h" -exec cp {} "${derived_root}include/React/" \;
find "${react_modules_head}" -type f -iname "*.h" -exec cp {} "${derived_root}include/React/" \;
find "${react_netw_headers}" -type f -iname "*.h" -exec cp {} "${derived_root}include/React/" \;
find "${react_image_header}" -type f -iname "*.h" -exec cp {} "${derived_root}include/React/" \;
The script does get invoked during a build-clean - which is not ideal. In my case there is one env variable which changes letting me exit the script early during a clean.
if [ "$RUN_CLANG_STATIC_ANALYZER" != "NO" ] ; then
exit 0
fi
react-native version 0.67.4 (recently updated) This build error started to show up in ios.
I found under my project > Edit Scheme > Build
There was a reference to "React" but it indicated "Missing"
So I removed it (little - button) and added React back (little + button) via the popup which has a Pods folder and a "React" pod project present.
So it looks like react-native used to supply a project file that you would set as a build target in the scheme: /node_modules/react-native/ReactReact.xcodeproj
However with this newer version of react that project is not present, which would explain why building will fail if you have a native module bridge (its searching for header files that don't exist)
I no longer get the build error, but I haven't verified it works. Will update once I get a positive outcome (or a negative one for that matter). Even if this does fix it, I am not sure if this is the "right" way, but I'm certainly open to suggestions.
In my case, the wrong target was selected in podfile, after correcting that, I was good to go.
In my case, I removed the 'arm64' from the release section located under Excluded architectures in the targets project
What you can do to get it right is:
1) npm uninstall reat-native-fs to uninstall library
2)npm unlink react-native-fs to unlink the library
Now the library is successfully removed and now install the lib again in your project and this time link everything manually. Sometime automatic linking causes this error.
I have create 3 project target (Development, Production and Staging).Expect Production other working fine after pull the changes of others while building the production target xcode giving the error :
gone through some of the available solution but no success!!!
If you change something the conflict will be occur, do like remove your WorkSpace once and again install or update your Pods,it will Work
Run pod install or pod update your CocoaPods installation.
For additional Information see this1
Choice-2
there's a problem with Cocoapods in your project. Sometimes cocoapods can get out of sync and you need to re-initiate cocoapods. You should be able to resolve this error by:
Deleting the Podfile.lock file in your project folder
Deleting the Pods folder in your project folder
Execute pod install in your project folder
Do a Clean in Xcode
Rebuild your project
Conclusion: don't run pod install while project opened in the Xcode.
Update answer
I. Project Cleanup
In the project navigator, select your project
Select your target
Remove all libPods*.a in Linked Frameworks and Libraries
II. Update CocoaPods
Launch Terminal and go to your project directory.
Update CocoaPods using the command pod install
I have solved my problem by this way :
After implementing lot many solution i got this error :
By removing Check pods manifest.lock, Copy pods resources and Embed pods frameworks from Build Phases of Tests project target(xxxTests) i solved the issue.
NOTE: If any one still getting any issue related to pods, then try to remove libpods-xxx.a from Link Binary with libraries and again add 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)