如何找到我的领域文件? [英] How to find my realm file?

查看:48
本文介绍了如何找到我的领域文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按领域创建了一个数据库,但由于我的操作系统(Yosemite)在/private/var/mobile中没有移动文件夹,因此无法找到该文件.

I have created a DB by realm and I am not able to find the file as my OS (Yosemite) dont have a mobile folder in the /private/var/mobile.

我应该如何访问我的领域以在浏览器中运行?

How should I access my realm to run in the browser?

来自Google网上论坛的交叉帖子

推荐答案

查找领域文件

对于Android

如何在Realm中查看我的Realm文件浏览器?

确保您的设备已连接,然后转到Xcode菜单 Window> Devices 中的设备窗口(⌘⇧2).在那里,您可以从已安装的具有调试权限的应用程序列表中选择设备和应用程序.

Make sure that your device is connected and go to the devices window in the Xcode menu Window > Devices (⌘⇧2). There you will be able to choose your device and your app from a list of installed apps with debugging permissions.

选择应用程序后,转到表格视图底部工具栏中的齿轮,然后选择下载容器..." .在那里,您可以将文件从文档位置拉到Mac.它将另存为xcappdata捆绑包.

After selecting your app, go to the cog in the toolbar at the bottom of the table view and select "Download Container…". There you will be able to pull the file from the documents location to your Mac. It will be saved as an xcappdata bundle.

在Finder中打开并保存了本地路径后,可以在选择文件时通过在查找器的上下文菜单中选择显示包内容" 来进入本地路径.一个新的查找器窗口将打开,您可以在以下路径(例如)中找到您的Realm:AppData/Documents/default.realm(目录"/private/var/mobile"是路径,iOS在设备文件系统.

When you open the local path in Finder, where you saved it, you can tap into that by selecting "Show Package Contents" in the context menu of the finder, when you select the file. A new finder window will open, where you find your Realm inside in the following path (e.g.): AppData/Documents/default.realm (The directory '/private/var/mobile' is the path, which is used by iOS on the device filesystem.

转到用户目录:

/Users/<username>/Library/Developer/CoreSimulator/Devices/<simulator-uuid>/data/Containers/Data/Application/<application-uuid>/Documents/default.realm

获取默认领域的当前路径的最简单方法可能是暂停模拟器,然后在LLDB控制台中输入以下内容:

Probably the easiest way to get the current path of the default realm is to pause the simulator and enter the following into the LLDB console:

Objective-C :
(lldb) po [RLMRealmConfiguration defaultConfiguration].fileURL

使用Realm Objective-C快速浏览:
(lldb) po RLMRealmConfiguration.defaultConfiguration().fileURL

使用Realm Swift进行Swift :
(lldb) po Realm.Configuration.defaultConfiguration.fileURL

或者如果您手边有一个RLMRealm实例,则可以使用:
(lldb) po myRealm.configuration.fileURL

Or if you have an RLMRealm instance at hand, you can use:
(lldb) po myRealm.configuration.fileURL

然后只需复制此路径,打开终端,然后输入open [此处粘贴的路径]

Then just copy this path, open your terminal, and type open [Pasted path here]

注意::某些路径中有空格,因此请务必在空格前使用"\"将其转义

NOTE: Some paths have a space in them so be sure to use "\" before the space to escape it

这可能是在模拟器中查找应用程序文件的最快方法.安装 SimPholders .这样一来,您就可以直接从菜单栏中访问应用程序的文档目录.

This is probably the fastest way to find the file of an app in the simulator. Install SimPholders. This will allow you to access your app’s documents directory directly from your menu bar.

注意有些人提到SimPholders将它们带到错误的模拟器应用文件夹中,如果是这种情况,请按照上述步骤打印出您的领域路径,然后打印出您的领域.路径

Note Some people have mentioned that SimPholders has taken them to the wrong simulator app folder, if that's the case for you, print out your realm path by following the steps above, printing out your realm.path

这篇关于如何找到我的领域文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆