Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Realm Model Object from Xcode

Tags:

xcode

realm

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:

enter image description 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.

like image 626
CodeBender Avatar asked Aug 06 '19 23:08

CodeBender


2 Answers

Xcode keeps its 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.

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 I cleaned and ran a second time which worked, and has been working for a couple of weeks with no side effects.

Later I finally found the root cause which is still related to the plug in. There are two options;

  1. If you want to continue to use the plug in which it installs the 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

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

which has a folder called plugin with information 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

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

like image 200
Jay Avatar answered Nov 17 '22 09:11

Jay


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 out:

#command script import "~/Library/Application Support/Realm/rlm_lldb.py" --allow-reload
like image 40
Chad Parker Avatar answered Nov 17 '22 08:11

Chad Parker