-
Notifications
You must be signed in to change notification settings - Fork 585
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
Support React Native installed with CocoaPods #884
Comments
Try adding To do this:
|
Hi @afces1. Thanks for reaching out about this. I recommend trying @makeitnew's suggestion but please let us know if that doesn't work or if you have any other questions. |
Hey @afces1, I don't believe we support installing via CocoaPods - only with npm and the React Native CLI. I'll add this to our backlog. In the mean time, the workaround proposed by @makeitnew seems viable. |
Not having success with @makeitnew's suggestion. Not sure if this is because my Pods/Headers/ folder set in my search paths are in fact empty or if I am missing a step. Also it appears the '/ios' parent folder is missing in the search path suggested, though that didn't change anything for me. Would love to see a step by step breakdown of how to set this up so I could identify where maybe I was going wrong. This has been my approach: 1.npm install --save realm 2.drag RealmReact.xcodeproj file into my ReactNativeStarter.xcodeproj and include header search paths as described above and link libRealmReact.a framework. (alternativley react-native link realm seems to have the same effect???) 3.when I build I am getting an error that 'React/RCTBridgeDelegate.h' file not found in node_modules/realm/react-native/ios/RealmReact. (I notice that the Pods/Header/ folder is completely empty) |
Hi, I'm also trying to install realm through cocoapods. Manual linking not helping in my case, because I'm using
But I got this error: Also I want to ask, how Realm add constructor to js global namespace. I'm just walking around js codebase and found that in index.js file, Realm constructor should be defined yet. |
Realm constructor is added here: https://github.com/realm/realm-js/blob/master/src/jsc/jsc_init.cpp#L40 |
@kristiandupont Sorry for stupid question, but how this code run in application? I mean, what need to do (how link this file properly) to execute this code at runtime and add constructor to js context |
@savelichalex sorry, but I haven't tried building with cocoapods and we don't officially support it so I am not sure myself :-) |
@kristiandupont I'm just trying to understand how it works and maybe this help me to understand how properly link it) I'm don't understand at which point in time jsc_init.cpp is calling and add constructor to js context. If rephrase: how initialization of library work |
Also wish to see support Cocoapods. |
For iOS development, most developers use |
FYI, CocoaPods v1.4.0 added support for |
It became some kind of convention to use Cocoapods to integrate React-Native dependencies for iOS. Is there any way we could move forward on this topic ? |
Any new updates on this? |
i have the same problem, i can't use Cocoapods and realm at the same time, any changes ? |
Thanks @vinhtnk for so quick answer. I believe I have linked libRealmJS.a but I'm not sure how to import it to my native code (native function called from RN), sorry if it's obvious but I don't really have iOS experience |
Hi @maciekstosio, the RealmJS only use for RN imported to iOS project, if you want to use realm for native also, you need to use RealmSwift or RealmCocoa. And if you want communicate between RN and native please refer RN docs: https://facebook.github.io/react-native/docs/communication-ios |
It's seems to work only without use_frameworks! option in Podfile |
Oh, I thought this issue was about supporting Realm as a pod. I second @dnolbon. For a while I have had working app with React Native installed with CocoaPods and Realm included as a library. Without |
Were you able to access the same Realm file from React Native and from Swift/ObjC? Could you please show how your Podfile look like? Thank you! |
This is extremely helpful as we're currently unable to use realm with |
I slightly modified the Pods Header Search Path: Otherwise I would get compiler errors around time.h I also removed GCDWebServer from here, as I have it in another dependency Now it builds and runs without issues. |
Anyone have a realm fork with a podspec supporting react native 0.60? Out of the many react native packages my app uses, realm is the only one to NOT have a podspec yet. Work-around: Call this from your package.json postinstall script.
Add this to your /ios/Podfile
Never mind. Now I have a run time error missing realm-constructor. How can realm be used in a react native 0.60 project that is using podfiles?
|
@esutton Seems like we need more than just And btw I'm also here:
20+ other libs but only for Realm there's no podspec. |
@rudyryk I tried changing my realm.podspec to be more inclusive without success to Since upgrading to react native to 0.60.4, I have everything building using pods except for realm js. |
Until this is implemented, this is how to get your project to build: #2431 (comment) Drag |
I can confirm. RN 0.60 and Realm is working with below manual steps 1. Manual linking RealmReact
2. modify header search patch
|
@MobileAppVault |
Inability to link Realm via CocoaPods (with |
This works for me! Thanks @MobileAppVault |
This Header_Search_Path is already available for RealmReact.xcodeproj. But the build is failing with <React/RCTBridge+Private.h> file not found error. This is occurring with React Native version 0.60+ |
In Realm JavaScript v3.4.0 we have added support for CocoaPods. |
@kneth That's great to hear, but if I understand this issue properly (which I'm currently still stuck on), wouldn't we need a podspec for RealmReact as well? I'm having issues building RealmReact, not RealmJS. |
@theminerymike - it could probably be separated into its own Subspec, but currently the RealmJS Podspec builds both Realm JS (the former libRealmJS) and Realm React into a single library. I were the one fixing this issue and to be honest, this was my first Podspec. Any feedback on it would be greatly appreciated. Do you see an issue in compiling everything to a single library instead of separating it into Realm JS and Realm React? |
Oh cool, that should do the trick. I wasn't aware of that. What I've done so far is adding this line to my Podfile, and unlinked the two realm libraries in Xcode, like I've done with other projects that now use cocoapods.
It seems to fail for me on line 21 of
Any advice? |
@theminerymike I suspect your Podfile needs some adjustments: In general it should not need to reference RealmJS explicitly. You could have a look at the Podfile of a newly initialized React Native project. If that doesn't work, please create a new issue and posting your Podfile there. |
Goals: adding RealmReact 1.0.2 project into XCode with pod install of [email protected] will not result in compilation failure.
Expected results: success app build using RealmReact project with [email protected] inside XCode project.
Actual results: compilation failure on RealmReact.mm: 'React/RCTBridgeDelegate.h' file not found in RCTBridge.h. This is most likely due to the iOS header breaking change introduced in [email protected] where React Native headers are expected to be enclosed in angle brackets, e.g. <React/RCTBridge.h>. Previously working on [email protected] using same app code.
Steps to reproduce:
directory structure: $root/app, $root/rn (app XCode project is sibling of react native directory rn)
target 'app' do
use_frameworks!
pod 'Fabric'
pod 'Crashlytics'
React libraries
pod 'Yoga', :path => '../rn/node_modules/react-native/ReactCommon/yoga', :inhibit_warnings => true
pod 'React', :path => '../rn/node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTImage',
'RCTLinkingIOS',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
], :inhibit_warnings => true
pod install to install Yoga and React Native
add RealmReact project into XCode from ../rn/node_modules/realm/react-native/ios/RealmReact.xcodeproj
compile iOS app
Version: Realm 1.0.2 / Xcode 8.1 / OS X El Capitan 10.11.6
The text was updated successfully, but these errors were encountered: