从Xcode删除领域模型对象 [英] Remove Realm Model Object from Xcode

查看:128
本文介绍了从Xcode删除领域模型对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年前,我将Realm用于iOS项目,但现在不再使用了.但是,我仍然可以在Xcode中使用模板,如下所示:

Ages ago, I used Realm with iOS projects, but am no longer doing so. However, I still have the template available in Xcode as seen here:

直到Xcode 11 beta才出现问题,每次运行项目时,我都会在控制台中看到以下内容:

It was never an issue until the Xcode 11 beta, where every time I run a project, I get the following in my console:

错误:模块导入失败:无效令牌(rlm_lldb.py,第37行)

error: module importing failed: invalid token (rlm_lldb.py, line 37)
File "temp.py", line 1, in

这时,我想将其删除,但是我无法从Realm中找到任何有关如何执行此操作的文档.

At this point, I'd just like to remove it, but I cannot find any documentation on how to do it from Realm.

推荐答案

Xcode将其自定义模板保留在

Xcode keeps it's custom templates at

~/Library/Developer/Xcode/Templates

文件夹是Xcode中的组".

Folders are "groups" within Xcode.

如果导航到该文件夹​​(确保XCode没有运行),则可以将Realm文件夹简单地拖到垃圾箱中.

If you navigate to that folder, (ensuring XCode is not running) you can simple drag the Realm folder to the trash.

修改

经过大量讨论,可能还会在以下路径中找到文件(可以关闭XCode)

After much discussion, there may be files located at the following paths as well that can be removed (with XCode Closed)

~/Library/Application Support/Realm/rlm_lldb.py

~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/RealmPlugin.xcplugin

然后我必须清理并运行一次-崩溃了.但随后清洗并再次运行即可,并且已经运行了几周,而且没有任何副作用.如果您有不同的经历,请发表评论.

Then I had to clean and run once - which crashed. But then clean and ran a second time which worked, and has been working for a couple of weeks with no side effects. Please post a comment if you have a different experience.

重要编辑

最后找到了仍然与插件有关的根本原因,并希望将所有信息放在一个地方.有两种选择;

Finally found the root cause which is still related to the plug in, and want to put all of the info in one place. There are two options;

1)如果要继续使用安装Realm Object模板的插件,可以在创建新对象时使用该模板,并在调试器窗格中添加对检查持久性RLMObjects属性值的支持.从这里下载最新的更新项目

1) If you want to continue to use the plug in which installs Realm Object template that can be used when creating new objects as well as add support for inspecting the property values of persisted RLMObjects in the debugger pane. Download the newest updated project from here

https://github.com/realm/realm-cocoa

有一个名为plugin的文件夹,其中包含用于安装插件的信息.我已经安装了它,似乎可以纠正与

which has a folder called plugin with info for installing the plug in. I've installed it and that seems to correct the error outlined in the question which is related to this error

2)否则,如果您想完全删除插件,则旧的模板安装程序会修改位于以下位置的隐藏文件

2) Otherwise, if you want to remove the plug in entirely, the old template installer modifies a hidden file located at

~/.lldbinit

您可以通过转到命令行,导航到您的主文件夹来查看它

you can see it by going to the command line, navigating to your home folder

cd..

然后显示隐藏文件

ls -a

主目录中的.lldbinit源于目标之前 您将要调试的创建.目的是建立 创建该目标的环境.

The .lldbinit in your home directory is sourced in BEFORE the target you are going to debug is created. It's purpose is to set up the environment for creating that target.

来自此答案.

因此该文件将包含此行

command script import "~/Library/Application Support/Realm/rlm_lldb.py" --allow-reload

它将尝试使用rlm_lldb.py文件设置XCode环境.

which will try to set up your XCode environment with the rlm_lldb.py file.

如果您不使用该插件并且已按照上述方法删除了其他文件,则可以通过编辑〜/.lldbinit文件来进一步删除对该文件的引用.

If you're not using the plug in and have removed the other files per above, you can further remove references to it by editing the ~/.lldbinit file.

如果您熟悉pico编辑器,则可以使用

If you are familiar with the pico editor you can edit the file with

pico .lldb

并用#注释行,或完全删除该行.

and either comment the line with a # or just delete the line entirely.

信贷由@sahm回答

Credit goes to the answer by @sahm to this question

这篇关于从Xcode删除领域模型对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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