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

4

7

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 ??

Selfinductance answered 26/5, 2018 at 6:2 Comment(2)
You gotta love the iOS stimulator ;-)Party
some looking to see more data about your app try this appSelfinductance
B
8

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

console.log('realm db file path:', realm.path);
Bezonian answered 26/5, 2018 at 7:41 Comment(1)
This is the most succinct method - remember tat you have to have initialised the Realm DB first.Merriott
R
1

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.

Romaineromains answered 5/3, 2024 at 11:54 Comment(1)
This answer does not specify how to locate the Realm file. In order to use the Studio - you must first know the file location. Also, the answer is specifically requesting help using the iOS simulator. A more appropriate answer has already been provided.Merriott
G
0

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

Grape answered 28/5, 2018 at 9:22 Comment(1)
The link is now broken. Any chance you know the updated location? and could edit your answer to include the steps?Veronaveronese
M
0

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.

Mellar answered 9/5, 2024 at 16:37 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.