I have dug through a number of posts trying to set up a react native project using cocoapods for native ios libraries but I inevitably end up with an error for a missing file in #import <React/RCTBundleURLProvider.h>
statement in my AppDelegate.m
file.
What is the proper way to use cocoa pods with react-native? At the time of this post my current version of RN is 0.43.4 and I'm using Xcode 8.2.1.
This was my process, curious where I might be going wrong:
1) In the terminal, I create a new project using react-native init TestProject
2) I run pod init
in the ios directory of that project
3) I add a dependency in my podFile and run pod install
4) The install process succeeds, but I see a warning that my targets override the 'OTHER_LDFLAGS
' and it's suggested I use $(inherit)
in my linker flags in Xcode.
5) So based on this SO post I add $(inherited)
to Project> TestProject > BuildSettings > linking> Other Linker Flags which was otherwise empty. I also checked and saw that $(inherited)
was already present in Targets > TestProject> Build Settings> Linking> Other Linker Flags and PreProcessor Macros as well.
6) At this point I see React/RCTBundleURLProvider.h file not found error on the #import <React/RCTBundleURLProvider.h>
statement in AppDelegate.m
7) Based on this SO post I try deleting the node modules
directory and back in the terminal run npm install
and when complete 'react-native upgrade'
. When it asks me if I want to replace AppDelegate.m
and project.pbxproj
files I say yes.
8) Back in xCode I clean my build but still have the error from step 6 importing <React/RCTBundleURLProvider.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With