Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

xcode - 从Xcode删除领域模型对象(Remove Realm Model Object from Xcode)

Ages ago, I used Realm with iOS projects, but am no longer doing so.

(几年前,我将Realm用于iOS项目,但现在不再这样做。)

However, I still have the template available in Xcode as seen here:

(但是,我仍然可以在Xcode中使用模板,如下所示:)

在此处输入图片说明

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

(直到Xcode 11 beta为止,这从来都不是问题,在Xcode 11 beta中,每次运行项目时,我都会在控制台中看到以下内容:)

error: module importing failed: invalid token (rlm_lldb.py, line 37)

(错误:模块导入失败:无效令牌(rlm_lldb.py,第37行))
File "temp.py", line 1, in

(在第1行的文件“ temp.py”中)

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

(此时,我只想删除它,但是我无法从Realm中找到任何有关如何执行该操作的文档。)

  ask by CodeBender translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Xcode keeps it's custom templates at

(Xcode将其自定义模板保留在)

~/Library/Developer/Xcode/Templates

Folders are “groups” within Xcode.

(文件夹是Xcode中的“组”。)

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

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

Edit

(编辑)

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

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

~/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.

(如果您有其他经验,请发表评论。)

IMPORTANT EDIT

(重要编辑)

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) 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 adds support for inspecting the property values of persisted RLMObjects in the debugger pane.

(1)如果要继续使用该插件,该插件将安装在创建新对象时可以使用的Realm Object模板,并在调试器窗格中增加了对检查持久性RLMObjects属性值的支持。)

Download the newest updated project from here

(从此处下载最新的更新项目)

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

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

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

(该文件夹有一个名为plugin的文件夹,其中包含用于安装该插件的信息。我已经安装了它,并且似乎可以纠正与该错误相关的问题中概述的错误)

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

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

~/.lldbinit

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

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

cd..

and then showing hidden files

(然后显示隐藏文件)

ls -a

The .lldbinit in your home directory is sourced in BEFORE the target you are going to debug is created.

(主目录中的.lldbinit源于创建要调试的目标之前。)

It's purpose is to set up the environment for creating that target.

(目的是建立用于创建该目标的环境。)

from this answer.

(从这个答案。)

So that file will contain this line

(这样该文件将包含这一行)

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

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

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

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.

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

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

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

pico .lldb

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

(并用#注释该行,或者完全删除该行。)

Credit goes to the answer by @sahm to this question

(感谢@sahm回答这个问题)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...