Closed
Description
Goals
Using Realm normally
Expected Results
Actual Results
after install Realm and pod install
, app will launch with error Missing Realm constructor
. After research through github, I found that we should link libRealmReact.a
to Link binary with libraries
. But after linked, app throw error that 155 duplicate symbols for architecture x86_64
.
Steps to Reproduce
react-native init exampleProject
yarn add realm
cd ios && pod install
Code Sample
import Realm from 'realm
Version of Realm and Tooling
- Realm JS SDK Version: 3.5.0
- Node or React Native: node 10.15.3 RN 0.61.2
- Client OS & Version: Mac OSX Catalina 10.15.1 Xcode 11.2.1
- Which debugger for React Native: None
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
hauhuynh1208 commentedon Dec 4, 2019
Confirm that only iOS platform experience this bug, Android still work properly.
kneth commentedon Dec 4, 2019
I haven't been able to reproduce it. I am using Realm JS v3.5.0 and React Native v0.61.2 but on macOS v10.14.6 and Xcode 11.0 (build version 11A420a).
gangwarily commentedon Dec 4, 2019
Running into this same issue on a pre-existing project that was previously using Realm JS v2.29.2. On macOS v10.4.6, RN v.0.61.2 and Xcode 11.2.1.
hauhuynh1208 commentedon Dec 5, 2019
@kneth I created a new project and also added
realm
, it is working normally. However, my pre-existing project still throw error. I confirm that my pre-existing project used to run normally and I didn't update any packages. How can I share my pre-existing project (private project) so you can take a look?hauhuynh1208 commentedon Dec 5, 2019
@gangwarily After I added all the packages from pre-existing project to the new one, my new project ran into the same issue as the existed project. Let's compare to see which packages we have the same
kneth commentedon Dec 5, 2019
@hauhuynh1208 You can send it to
help--at--realm.io
and mention that it is for me. Eventually I will get it 😄.hauhuynh1208 commentedon Dec 5, 2019
@kneth I think I found the way how you can reproduce the bug. First of all, init the fresh project. Then install realm, make sure app is running properly. Then you install any packages (such as redux, react-native-maps ...). Then bug occurs
I sure you will encounter this bug :)
kneth commentedon Dec 6, 2019
@hauhuynh1208 I do encounter the bug.
We believe it is a
yarn
issue, and we are working on a solution (see #2623). When you doyarn add redux
, thenode_modules/realm
folder is reset, and the header and binary files you need, are deleted!Currently, two workarounds are possible: use
npm
instead ofyarn
or add the line"postinstall": "node node_modules/realm/scripts/download-realm.js ios --sync"
to thescripts
section in yourpackage.json
(see #2617 (comment)).gangwarily commentedon Dec 6, 2019
@kneth, I'm using npm and running into the same issue. Not sure if there are multiple causes for this :/
hauhuynh1208 commentedon Dec 6, 2019
@kneth I have tried postinstall solution before, and it still fail. And I just tried npm, but still no luck. Did you do these solutions successfully?
P/s for my existed project, when I do
postinstall ...
, the error that xcode cannot find realm has been passed. But I continue to fall in the problem I described in this thread title.kraenhansen commentedon Dec 6, 2019
What happens if you run
pod install
as the last step beforereact-native run-ios
?esutton commentedon Dec 6, 2019
@hauhuynh1208 Search your ios/YourProject.xcodeproj for "realm". Mine had dozens of realm entries.
I think this may be a problem when upgrading existing projects. Not sure how best to solve.
Option A
This is what I did.
Option B
This might help understand what realm is trying to do. ( Not sure if it is correct or not )
I ended up rolling back to "realm": "^3.2.0" and manually adding and linking the realm project in xcode.
I spent so much time on this trying so many things. I and not sure what finally sorted things out.
File: react-native.config.js
I am sticking with realm 3.2.0 for now:
33 remaining items