Realm-js: Issue with getting realm to run on react-native 0.46.0 (missing realm constructor)

Created on 1 Sep 2017  路  4Comments  路  Source: realm/realm-js

Goals

I am trying to get realm running in a react-native project.

Expected Results

I expect react-native link to work, or when you manually link the build to pass.

Actual Results

On React-native you get the missing realm constructor.
After checking with react-native link realm, this is the output:

Scanning 521 folders for symlinks in /Users/techwolf12/Documents/React/kerckebosch-energieplein/node_modules (5ms)

When manually adding the project and linking the binary, this is the xcode build result:

Apple Mach-O Linker Error Group
  "_deflate", referenced from:
  "_deflateBound", referenced from:
  "_deflateEnd", referenced from:
  "_deflateInit2_", referenced from:
  "_deflateInit_", referenced from:
  "_inflate", referenced from:
  "_inflateEnd", referenced from:
  "_inflateInit2_", referenced from:
  "_inflateInit_", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to Reproduce

  1. install realm via npm and try to run the project. It's unclear, you probably won't be able to

Code Sample

Not relevant, I can provide devs with a project.

Version of Realm and Tooling

  • Realm JS SDK Version: 0.46.0
  • Node or React Nattive: react-native-cli: 2.0.1
    react-native: 0.46.0
    node: v6.11.0
    npm: 5.3.0
  • Client OS & Version: MacOS 10.12.6
  • Which debugger for React Native: chrome

Most helpful comment

This solved my problem! No where to find in the documentation, I needed to link it manually and also add libz.tbd (from iOS itself) to be able to run this. Thanks a lot @MrStofkat !

All 4 comments

You need to add libz to the XCode Project:
Build Phases > Link Binary with Libraries > add libz.tbd

This solved my problem! No where to find in the documentation, I needed to link it manually and also add libz.tbd (from iOS itself) to be able to run this. Thanks a lot @MrStofkat !

Yes, they somehow forget to mention this step entirely in the documentation.

Probably because you need to run react-native link realm which would handle this for you, however this wouldn't in my case

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CrystalRanita picture CrystalRanita  路  3Comments

fever324 picture fever324  路  4Comments

texas697 picture texas697  路  3Comments

max-zu picture max-zu  路  3Comments

MihaelIsaev picture MihaelIsaev  路  3Comments