abby37
abby37

Reputation: 647

How to view realm db created by react-native in ios stimulator

I want to access realm database created by my ios app that I created using react-native. Its easier to use adb pull for android but for ios I am not getting much idea. There are some links like -

  1. realm-file in ios app
  2. to find app uuid for above link

So any help, how to view realm db for developing and debugging purpose for react-native developed ios app.

Thanks for the answer but additional (out of curiosity) Question - but how to find app uid which are installed by react native on ios simulator ??

Upvotes: 7

Views: 3185

Answers (4)

Brogrammer
Brogrammer

Reputation: 472

Another easy way –in bash terminal–:

  1. Go to ~ cd /Library/Developer/CoreSimulator/Devices.
  2. Look for ~ find . -name "default.realm" –it will return the Realm db path–.

./198DD3D6-D8C7-4520-A5A2-E65865705A08/data/Containers/Data/Application/48670837-21DB-4F7C-899D-DE809478A56E/Documents/default.realm

  1. Open previous path ~ open my/path/.

If you have Realm Studio already installed it will open automatically.

Upvotes: 0

jannunen
jannunen

Reputation: 11

This has changed a bit:

As of March 2024 this goes as follow.

First, download Realm Studio: https://studio-releases.realm.io/

Then find out where the file resides (as seen in previous answer):

https://www.mongodb.com/docs/realm/studio/open-realm-file/

With JS:

// Open a realm.
const realm = await Realm.open({
  schema: [Car],
});
// Get on-disk location of the Realm
const realmFileLocation = realm.path;
console.log(`Realm file is located at: ${realm.path}`);

or

  console.log("Realm DB location",realmInstance.getInstance().path);

Then you'll find the path. Mine was somewhere like:

/Users/xxx/Library/Developer/CoreSimulator/Devices/82281-EEAF-DILLIGAF-A4F/data/Containers/Data/Application/362F03BF-L338-AA18-A677-3CB0A52C9A10/Documents/default.realm

Then open the Realm Studio and open that file.

Upvotes: 1

ast
ast

Reputation: 526

With the iOS emulator you can just find the path and open the Realm directly (which allows you to see the changes as they happen, great for debugging), on Android you will have to copy the file out to the regular file system.

It is all described in the docs for Realm Studio: https://docs.realm.io/platform/realm-studio/view-your-data#viewing-realms-from-emulators

Upvotes: 0

Aditya
Aditya

Reputation: 3673

While searching through the web, got the answer in docs:

console.log('realm db file path:', realm.path);

Upvotes: 8

Related Questions