Remove Realm Model Object from Xcode

こ雲淡風輕ζ 提交于 2019-12-22 05:28:14

问题


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:

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

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

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


回答1:


Xcode keeps it's custom templates at

~/Library/Developer/Xcode/Templates

Folders are “groups” within Xcode.

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

Edit

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.

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. Download the newest updated project from here

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

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

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

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.

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.

Credit goes to the answer by @sahm to this question




回答2:


The rest of the Realm plugin can be disabled by editing ~/.lldbinit and removing or commenting out this line:

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

add a # to comment it:

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


来源:https://stackoverflow.com/questions/57385022/remove-realm-model-object-from-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!