-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Cocoapods installs the "React" pod, creating conflicts #621
Comments
I've been using an ugly hack in the PodFile: invertase/react-native-firebase#414 (comment)
I really wish there was some better way. Please find one for me 😄 |
Having the same issue, but the proposed fix above doesn't work for me. If I add it, I end up with missing component errors. |
You'll also need to link react-native manually, by adding the projects to libraries in your main project, and to your "Linked Frameworks and Libraries" in the Build Phases. Such that you have it linked both manually and using cocoapods, and then add the hack to remove the cocoapods one, such that you're able to archive your project. |
Thanks for the tip @msand - fixed for me! This definitely needs a less "hacky" fix. |
Great, happy I could help. I managed to get a slightly less hacky version working today. Removed the manually linked version, but then building/running/archiving from XCode breaks. But I found that compiling manually from the cli still works, so I added two npm scripts to package.json
It would be nice to be able to build from XCode as well. Not sure how its possible that it works from the cli but is broken there. |
Having this issues as well. Currently, is the best solution to just to not use Cocoapods? Thanks |
Another approach I found is to remove all the manually linked libraries and let cocoapods link React as well. This doesn't allow starting debug mode from xcode though, but works with run-ios in the cli. If you need to debug the obj-c code, I recommend duplicating the target which you're installing the pods in to, and manually link react there. If you can, I would recommend avoiding cocoapods, as it's just another thing which can break in your system. If npm, react-native link and normal xcode works for you, then just use that. If you need something from outside npm, like with react-native-fbsdk (or want swift code, I think) etc., then you need cocoapods at least. |
I'm with @jgresham is the best solution to just avoid Cocopods? This is super frustrating that causes duplicate compilations. |
Hey everybody, I've investigated the installation of React Native dependencies a little more in-depth; and I've come to a quite clean cocoapod-based solution (I hope). I've summed up the approach in a blog post at https://sandstorm.de/de/blog/post/react-native-managing-native-dependencies-using-xcode-and-cocoapods.html . Maybe it helps somebody :) All the best, |
Hello, My setup is finally working (before app would crash on start when run or archived from Xcode). Running 'yarn ios' was working fine. I followed the steps outlined by @msand
But, I also had to
Otherwise, linking fails.
|
Fixed conflicts with these changes in
|
As @roycedot mentioned above, I had to edit Build Settings -> Other Linker Flags. I removed After that I got a successful build and a working debug menu. |
Has anyone tried removing this line? |
@msand thanks for your workaround ! I had to add yoga to make it work, cf facebook/react-native#20492 (comment) @skurfuerst thanks for your great blog post, you should update it adding yoga ! |
@roycedot sorry a few months later asking you this but could you provide a snippet of how you implemented point (2) above? Edit [CP] Embed Pods Frameworks in Build Phases on my main Xcode project to remove React from Input Files and Output Files |
Came across this thread debugging a separate issue– but I recently ran into this same problem and wanted to share in case it helps others. It's a known issue that CocoaPods + React-Native is a current pain point. If you do a search in this thread for "cocoapods"– you'll see there's a lot of good discussion: react-native-community/discussions-and-proposals#104 tl;dr– Comment by Facebook: We are currently working on recommending CocoaPods by default for iOS projects and with it we are looking to simplify link to cause fewer problems for people. If you notice that the react@0.11.0 pod is being installed when you run pod install– you'll want to update your podfile to include React and it's dependencies– in the end your podfile should look similar to this: |
I just want to add that it might be necessary to remove $ rm -rf ios/Pods/React |
I'm not sure how to best handle this, but my project uses pods, and when I install react-native-svg as a pod, it depends on the React pod, and installs it.
My builds then start failing because there are 2 versions of React declared.
How are folks dealing with this?
Edit: It's similar to this issue: oblador/react-native-vector-icons#303
The text was updated successfully, but these errors were encountered: