0

I'm trying to use Realm in my app, because I only have to store data in a local database on the device, but when I do expo start and open the app on my phone, I get the following:

Error: Missing Realm constructor. Did you run "pod install"?

Which only seems to be a problem in iOS. If I do the following:

cd ios && pod install && cd ..

I get another error, which seems to be with Installing glog (0.3.5), that displays a whole bash file, the gist of it being:

checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
./Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-04b94/missing: Unknown `--is-lightweight' option
Try `./Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-04b94/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `./Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-04b94':
configure: error: C compiler cannot create executables

So it feels like I'm stuck in a loop.

To me there are 3 options:

  1. I don't need to support iOS, so the most apparent solution would be to exclude that from the build. I'm using flexbox anyway, next to other Android only solutions
  2. Get Realm to work with Expo, though I'm not sure how a database like that would work with a temporary version of the app
  3. Use another storage solution. That would be the absolute last option, because I like the way I can query data with it and still store the data locally on the device

I could also eject from Expo and use vanilla React Native instead, but I don't know how I can test real time on my device (without adding a whole lot of bloat or adding yet another learning curve anyway).

Any suggestions?

Swimmer
  • 13
  • 4
  • It seems the issue is just with iOS - if so, see the last answer to [this question](https://stackoverflow.com/questions/71694536/trying-to-import-realm-but-getting-error-missing-realm-constructor-did-you-ru) – Jay Feb 23 '23 at 19:40
  • What versions of Realm, RN, and Expo are you using? – Nikola Irinchev Feb 24 '23 at 11:51
  • I'm sorry that it took so long. I'm using Realm 11.4.0, React Native 0.70.5 and Expo 47.0.12. I did a global search within the project on CocoaPods and I haven't been able to find it. However, a search on iOS gave me a clue: the package-lock.json contains a couple of dependencies towards @react-native-community/cli-platform-ios (among which react-native itself). I'm not sure if this is the issue and if so, how to resolve this. – Swimmer Apr 05 '23 at 14:37
  • I can't edit yet, but it seemed that Hermes wasn't relevant anymore, a `npm install realm@hermes` confirmed that. And `npx expo run:android` asks for Android SDK, which I don't have installed and previously I didn't have to. I already had my doubts about the availability of Realm for a dev environment, but it should be, right? – Swimmer Apr 05 '23 at 15:22

0 Answers0