realm-js: iOS - Missing Realm constructor - please ensure RealmReact framework is included!

When I run I get error (red screen) on iOS emulator Missing Realm constructor - please ensure RealmReact framework is included!

'use strict'
import Realm from 'realm'
{...}
export default new Realm({schema: [WeatherProperty, WeatherStation, WeatherCurrent, WeatherDetail, WeatherTemperature, WeatherTemperatureData]})

Note that I am not getting any error in Android.

My dependencies :

  "dependencies": {
    "react": "^0.14.7",
    "react-native": "^0.22.2",
    "react-native-router-flux": "aksonov/react-native-router-flux#dcc7558",
    "react-native-viewpager": "bosung90/react-native-viewpager#db525c8",
    "react-redux": "^4.4.1",
    "realm": "^0.11.1",
    "redux": "^3.3.1"
  },
  "devDependencies": {
    "redux-devtools": "^3.1.1"
  }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 39 (7 by maintainers)

Most upvoted comments

I fix it just by adding this two lines in MainApplication.java


import io.realm.react.RealmReactPackage; // ADD THIS
...
  @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new RealmReactPackage() // AND THIS
      );
    }

here’s a solution that worked for me on el capitan in the simulator:

  1. close all simulators/device builds
  2. stop the package manager running in terminal (or better yet, just restart terminal)
  3. open the ios folder in your app root in finder
  4. go into the build folder (note: you won’t see this build folder in atom, so just right click ios and click open in finder)
  5. delete everything inside of the build folder (just move to trash and keep trash around in case you’re worried)
  6. run react-native run-ios to rebuild the whole thing

it appears when you link new modules, you have to rebuild the build to include it.

@enu-kuro

  1. Install rnpm npm install -g rnpm
  2. Execute this in command line within your project rnpm link realm
  3. Go to Xcode, select Show your project navigator -> select your project (blue icon) -> select general tab -> scroll to bottom and add “libRealmReact.a” to Linked Frameworks and Libraries by pressing + button.

Everything works good when I build for my iPhone but I get the “Missing Realm constructor - pl…” when I run it in the simulator. Can anyone help with this?

“react”: “15.2.1”, “react-native”: “0.31.0”, “realm”: “^0.14.3”

This issue has presented itself for v47 & v48 on iOS only.

Still not working on iOS 😦 , Does anyone know how to solve this? “react”: “15.3.0”, “react-native”: “0.32.0”, “realm”: “^0.13.2”

I’ve also tried realm ‘0.12.0’, ‘0.14.0’, ‘0.14.3’, Those are not working…

PS: Android is fine.

Thanks @Yhozen, it worked for me.

Me I have the libRealmReact.a but still the same problem … any idea can be the problem ?