Realm-js: Error installing and running Realm iOS

Created on 24 Oct 2018  路  11Comments  路  Source: realm/realm-js

Goals

Install Realm and be able to run the app

Expected Results

Realm installs and able to be used in the app.

Actual Results

Build fails and app comes with missing Realm constructor error.

Warning when realm installs

node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download.

Seems to install fine. React-native link realm produces no errors.

Have tried installing Realm in a brand new build and same issue. Funnily enough it runs fine on Android.

The build fails when running react-native run-ios.

In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/chrono:303:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:59:9: error: no member named 'tm' in the global namespace
using ::tm;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:60:9: error: no member named 'clock' in the global namespace
using ::clock;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:61:9: error: no member named 'difftime' in the global namespace
using ::difftime;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:62:9: error: no member named 'mktime' in the global namespace; did you mean 'mktemp'?
using ::mktime;
      ~~^
In file included from /Users/Developer/Documents/Projects/TeRakauTaumatuaApp/node_modules/realm/react-native/ios/RealmReact/RealmReact.mm:19:
In file included from /Users/Developer/Documents/Projects/TeRakauTaumatuaApp/node_modules/realm/react-native/ios/RealmReact/RealmReact.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/usr/include/assert.h:44:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/usr/include/stdlib.h:216:7: note: 'mktemp' declared here
char    *mktemp(char *);
         ^
In file included from /Users/Developer/Documents/Projects/TeRakauTaumatuaApp/node_modules/realm/react-native/ios/RealmReact/RealmReact.mm:19:
In file included from /Users/Developer/Documents/Projects/TeRakauTaumatuaApp/node_modules/realm/react-native/ios/RealmReact/RealmReact.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:31:
In file included from ../../../../ios/Pods/Headers/Public/gRPC-C++/grpcpp/support/time.h:22:
In file included from ../../..
/../ios/Pods/Headers/Public/gRPC-C++/grpcpp/impl/codegen/time.h:22:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/chrono:303:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:63:9: error: no member named 'time' in the global namespace
using ::time;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:65:9: error: no member named 'asctime' in the global namespace
using ::asctime;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:66:9: error: no member named 'ctime' in the global namespace
using ::ctime;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:67:9: error: no member named 'gmtime' in the global namespace
using ::gmtime;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:68:9: error: no member named 'localtime' in the global namespace
using ::localtime;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:70:9: error: no member named 'strftime' in the global namespace
using ::strftime;
      ~~^


** BUILD FAILED **

Version of Realm and Tooling

Realm JS SDK Version: v2.18.0
Node or React Native: Node v8.11.3 RN @0.57.1
Client OS & Version: OS Mojave 10.14

O-Community T-Help

Most helpful comment

Facing same issue on RN 0.61.2 and Realm 3.2.0. Any suggestions?

All 11 comments

@taylor-pringle I have facing this issue while using XCode 10, are you using XCode 10? If you using Xcode 10 then you need downgrade to previous XCode version because react-native doesn't fully supporting XCode 10 yet.

@renalpraba Unfortunately downgrading did not help.

Hey - looks like you forgot to add a T:* label - could you please add one?

I downgraded to Xcode 9.4.1 however I still had issues trying to install realm.

Solution found here https://github.com/realm/realm-js/issues/1927!!

Remove this Header Search Path from RealmReact.xcodeproj/project.pbxproj
"$(SRCROOT)/../../../../ios/Pods/Headers/Public/**"

Worked for me

Hey - looks like you forgot to add a T:* label - could you please add one?

@taylor-pringle and @bmunkholm

Initially I tried clearing the build folder for cleaning the derivedData in Xcode that is suggested in realm docs
https://realm.io/docs/javascript/latest/#troubleshooting

Then tried your solution, I could still got the same error in iOS which says "Missing Realm constructor. Did you run "react-native-realm"? "

Versions:
Xcode : 10.1
realm : 2.19.1
react-native: 0.56.0

May I lend me your help regarding this.

Thanks

@Hari70a

Yes I did run react-native-realm and linked it to the xcode libraries. After this I then edited the file as described in the comment above and it fixed my issue. I did also downgrade to xcode 9.4 which may or may not have helped with the situation.

Thanks

for React Native 0.61 and Realm 3.1.0, this step doesn't help anymore. Any suggestion?

Facing same issue on RN 0.61.2 and Realm 3.2.0. Any suggestions?

Also facing this issue, firestone and realm results in this error

Was this page helpful?
0 / 5 - 0 ratings