Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realm DB compatibility issue between Swift SDK and React Native app #8703

Open
sheetalj27 opened this issue Oct 30, 2024 · 1 comment
Open

Comments

@sheetalj27
Copy link

How frequently does the bug occur?

Always

Description

Description:
I've developed a React Native app that uses a Swift SDK, both of which rely on Realm DB. The following versions are in use:

iOS (SPM): https://github.com/realm/realm-swift.git, version 10.12.0
React Native: "realm": "^20.0.0"
Problem:
Screenshot 2024-10-30 at 2 00 06 PM

The app crashes when attempting to write an object in Realm.

One of our clients also uses this SDK in their React Native app, and they are encountering the following error:

Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=15 "History schema version not consistent" UserInfo={Error Name=IncompatibleSession, NSLocalizedDescription=History schema version not consistent, Error Code=15}

This issue only occurs in the React Native environment. We don't have exact version details for the client's environment.

Stacktrace & log output

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

Can you reproduce the bug?

Always

Reproduction Steps

Set up the React Native app:

Initialize a new React Native project.
npm install [email protected] --save

Integrate the Swift SDK:
Use Swift Package Manager to include the SDK:
.package(url: "https://github.com/realm/realm-swift.git", .upToNextMajor(from: "10.12.0")),

The SDK uses Realm Swift version 10.12.0.

Invoke the Swift SDK from React Native:
Use React Native's NativeModules to call methods from the Swift SDK.
Within the Swift SDK, attempt to write an object to Realm:
let realm = try! Realm()
try! realm.write {
realm.add(myObject)
}
Run the React Native app and trigger the Swift SDK method.

Expected Behavior:
The object should be written to the Realm database without any crashes or errors.
Actual Behavior:
The app crashes with the error mentioned above when the Swift SDK attempts to write to Realm.

Version

this is version independent

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

17.2

Build environment

Xcode version: 15.1
swift-tools-version: 5.9

Copy link

sync-by-unito bot commented Oct 30, 2024

➤ PM Bot commented:

Jira ticket: RCOCOA-2447

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant