Try! Realm() never returns

I’m working on a React Native app that calls native iOS (Swift) and Android (Java) code for Realm.
I’ve got Andoird working where I can call a function from React Native → hit Java code → make a request → store the response data in local Realm. For iOS I’ve followed the docs https://docs.mongodb.com/realm/sdk/swift/
but when the code gets to let realm = try! Realm() it never returns from Realm(), the next line of code isnt reached.

The only output I get is

2022-01-26 09:09:48.817027+1300 essyncer[11028:2186300] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2022-01-26 09:09:48.826227+1300 essyncer[11028:2186307] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics

The following is created
default.realm.managment folder
default.realm.lock
default.realm

When I open default.realm in Realm Studio I get
Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture.
If I exit the simulator I can view the default.realm in Realm Studio, there is no schema which is expected.

Installed RealmSwift with pods
pod 'RealmSwift', '10.22.0'
Xcode Version 13.2.1
Target is iOS 11.0

Hi @Nate_Fort,

  • Have you tried to properly handle the try, i.e. embedding it in a do {…} catch {…} block? Do you get any error?
  • How about threading? Is the call happening in the expected thread?
  • Is the same code working when used from a native app? Could be the React Native embedding that interferes here…

Welcome to the forums

Can you post a code snippet showing the code you are using including the surrounding code? e.g. if it’s within a function, can you include that so we have a better understanding of when that code is being called?

1 Like

Seems related to this