删除了Realm,但仍然出现此错误:模块导入失败:无效令牌(rlm_lldb.py,第37行)文件"temp.py",第1行 [英] Removed Realm, but still getting this error: module importing failed: invalid token (rlm_lldb.py, line 37) File "temp.py", line 1,

查看:536
本文介绍了删除了Realm,但仍然出现此错误:模块导入失败:无效令牌(rlm_lldb.py,第37行)文件"temp.py",第1行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两年前,我在一个项目中尝试将Realm与Cocoapods结合使用. Realm无法解决问题,因此我将其删除. Cocoapods无法解决问题,因此我最终也将其删除,并改用Carthage.

I tried using Realm with Cocoapods in a project two years ago. Realm didn't work out, so I removed it. Cocoapods didn't work out, so I eventually removed that as well and switched to Carthage.

随着Xcode 11的出现,我开始看到此错误:

With the advent of Xcode 11, I started seeing this error:

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

它似乎没有引起任何崩溃,所以我愚蠢地忽略了它.昨晚,我在运行最新iOS 12(12.4.3)的iPod Touch第6代上运行了一个应用程序.该应用程序因此错误而崩溃.

It didn't seem to cause any crashes, so I stupidly ignored it. Last night I ran an app on an iPod Touch Generation 6 running the latest iOS 12 (12.4.3). The app crashed with this error.

那时我意识到我在包括模拟器在内的每台设备上的每个应用程序中都遇到了这个错误.

I realized then that I was getting this error for every app on every device, including the simulator.

我尝试返回并重新运行所有代码以删除CocoaPods,看来它确实已删除.

I tried going back and re-ran all of the code to remove CocoaPods, and it seems like it is really removed.

我的计算机上仍然存在一些Realm文件:

There are still some Realm files on my computer, most notably:

~Library/Application Support/Realm/rlm_lldb.py

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

当我删除这些文件(通过重命名和移动它们)时,每次在任何设备上运行任何应用程序时,我仍然会收到错误消息:

When I delete those files (by renaming and moving them), I still get an error every time I run any app on any device:

error: module importing failed: invalid pathname

有些东西仍在寻找那些文件,但它甚至不知道它们的名称.因此,我将文件放回原处,回到原来的错误状态.

Something is still looking for those files, but it doesn't even know their name. So I put the files back, and I am back to the original error.

有人建议,这是与以下问题相同的问题: 从Xcode删除领域模型对象

It was suggested that this is the same issue as: Remove Realm Model Object from Xcode

即使我遇到相同的错误,我的Xcode中也没有Realm对象模型.这个问题的解决办法根本没有解决我的情况.还有另一条评论可能对这个问题有帮助,那就是编辑~/.lldbinit.但是,没有任何关于如何编辑~/.lldbinit的解释,也没有暗示它可以工作.

I do not have the Realm Object Model in my Xcode, even though I am getting the same error. The solution to that question did not address my situation at all. There is another comment that may be helpful to this issue, and that is to edit ~/.lldbinit. But there is no explanation of how to edit ~/.lldbinit or suggestion that it worked at all.

我实际上认为编辑~/.lldbinit可能会有所帮助,但是我不知道该怎么做.

I actually think that editing ~/.lldbinit might help, but I have no idea how that might be done.

推荐答案

卸载并重新安装Xcode不能为我解决此问题.

Uninstalling and reinstalling Xcode did not solve this issue for me.

根据该问题的不可接受答案,

As per the unaccepted answer in this question,

从Xcode删除领域模型对象

我需要编辑~/.lldbinit.老实说,我不完全了解这个文件是什么.进入或编辑都不容易.

I needed to edit ~/.lldbinit. To be honest, I don't completely understand what this file is. It is not easy to get to or to edit.

我从Ray Wenderlich找到了本教程,

I found this tutorial from Ray Wenderlich,

https://www.raywenderlich.com/612-custom- lldb-commands-in-practice

找到进入编辑器的方式,突出显示了有问题的行,

found my way to the editor, highlighted the offending line,

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

删除文本,然后退出,选择在退出时保存.

removed the text, and exited, choosing to save upon exit.

当我重新打开Xcode,清理,构建并运行一个应用程序时,错误消失了.

When I re-opened Xcode, cleaned, built and ran an app, the error was gone.

对此我感觉不太好.我不知道我做对了没有.我讨厌在终端中做我不了解的事情.

I don't feel great about this. I don't know if I did the right thing. I hate doing things in the Terminal that I don't understand.

我向Realm提出了这个问题,他在大约同一时间还建议该问题可能与lldbinit有关.编辑文件并停止看到错误后,我与Realm共享了解决问题的步骤.我确认这是正确的做法.此外,请参阅下面杰伊关于他如何解决此问题的评论:

I raised this issue to Realm, who had also suggested around the same time that the issue might be with lldbinit. After I edited the file and stopped seeing the error, I shared the steps I took to fix the problem with Realm. It was confirmed to me that that was the right thing to do. Additionally, please see the comment from Jay below about how he was able to solve this issue:

对于未来的读者来说,有趣的是,我能够重复此操作 问题,但解决方案有所不同.我能够删除文件 在原始问题中显示,然后清理并运行项目.然后, 清理并再次重建,它似乎正在工作.两个文件都出现 大约在2016年.

For future readers, interestingly enough, I was able to duplicate this issue but the solution was different. I was able to delete the files showin in the original question, then clean and run the project. THEN, clean and rebuild again and it seems to be working. Both files appear to be circa 2016.

虽然这对我不起作用,但我想将其包含在此答案中,因为如果您遇到此问题,我认为最好先尝试一下.

While this did not work for me, I want to include it in this answer because I think it would be good to try this first if you are having this issue.

这篇关于删除了Realm,但仍然出现此错误:模块导入失败:无效令牌(rlm_lldb.py,第37行)文件"temp.py",第1行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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