如何在ios stimulator中查看react-native创建的realm db

问题描述 投票:0回答:3

我想访问我使用react-native创建的ios应用程序创建的领域数据库。在 Android 上使用

adb pull
更容易,但在 ios 上我不太了解。有一些链接,例如 -

  1. ios 应用程序中的领域文件
  2. 查找上面链接的应用程序 uuid
所以有什么帮助,如何查看领域数据库以用于react-native开发的ios应用程序的开发和调试目的。

感谢您的回答,但还有一个(出于好奇)问题 - 但如何找到在ios模拟器上通过react native安装的应用程序uid??

react-native realm react-native-ios realm-mobile-platform
3个回答
6
投票
在网上搜索时,在

docs中得到了答案:

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

0
投票
使用 iOS 模拟器,您只需找到路径并直接打开 Realm(这使您可以看到发生的更改,非常适合调试),在 Android 上,您必须将文件复制到常规文件系统。

Realm Studio 的文档中对此进行了全部描述:

https://docs.realm.io/platform/realm-studio/view-your-data#viewing-realms-from-emulators


0
投票
这已经改变了一点:

截至 2024 年 3 月,情况如下。

首先,下载Realm Studio:

https://studio-releases.realm.io/

然后找出文件所在的位置(如前面的答案所示):

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

与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}`);

console.log("Realm DB location",realmInstance.getInstance().path);
然后你就会找到路径。我的在某个地方是这样的:

/Users/xxx/Library/Developer/CoreSimulator/Devices/82281-EEAF-DILLIGAF-A4F/data/Containers/Data/Application/362F03BF-L338-AA18-A677-3CB0A52C9A10/Documents/default.realm
然后打开 Realm Studio 并打开该文件。

© www.soinside.com 2019 - 2024. All rights reserved.