警告:模块中的Swift错误.该模块中的调试信息将在调试器中不可用 [英] warning: Swift error in module. Debug info from this module will be unavailable in the debugger
问题描述
我的swift + obj-c应用程序的控制台中没有调试值,并且收到一条非常无用的消息,该消息解释了调试器不起作用的原因:警告:模块XXX中的Swift错误.". XXX是我模块的名称,而不是我包含的第三方.
I have no debugging values in my console for my swift + obj-c app, and I get a really unhelpful message that explains why the debugger isn't working: "warning: Swift error in module XXX.". XXX is the name of my module, not a 3rd party that I include.
我的应用很快就出现了.我使用桥接头开始使用swift,最近我使用xcode工具将所有swift 2文件迁移到swift3.(但是我仍然有obj-c遗留物).我使用可可豆荚,这可能是导致问题的原因.
My app has been around before swift. I used the bridging header to start using swift, and I recently use the xcode tool to migrate all the swift 2 files to swift 3. (but I still have obj-c legacy in there). I use cocoa pods, which may be contributing to the problem.
(lldb) po self
warning: Swift error in module XXX.
Debug info from this module will be unavailable in the debugger.
(lldb) po self
warning: Swift error in module XXX.
Debug info from this module will be unavailable in the debugger.
我尝试遵循对此帖子的第二个答案和另外几个 我发现这暗示了同样的事情:删除重复的导入.
I tried following the second answer to this post and a couple others I have found that suggest the same thing: remove duplicate imports.
我尝试从我的swift项目中删除重复的导入.实际上,如果我运行find . -name "*swift" | xargs grep "import"
,则不会得到任何结果.因此,我极端地从所有swift文件中删除了所有导入文件(并注释掉了代码以使其编译),只是看我是否可以使调试器返回.
I tried removing duplicate imports from my swift project. In fact if I run find . -name "*swift" | xargs grep "import"
and I get no results. So I went to the extreme of removing all imports from all of my swift files (and commenting out code to get it to compile) just to see if I can get my debugger to come back.
所以...
- 这个问题还有解决方案吗?
- 有没有办法获得更详细的错误消息?
- 在我的桥接头中有重复的头是否有问题?例如,我的很多obj-c文件都导入了UIKit,并且我在桥接头文件中包含了其中的一些文件.
推荐答案
刚才我遇到了这个问题. 这是我的解决方案:
Just now I have encountered this problem. This is my solution:
如果您通过Cocoapods导入了第3个存储库,而该存储库是由Objective-C编写的,则需要通过以下方式导入它:
If you import 3rd repo by Cocoapods, and the repo is written by Objective-C, you need to import it by this way:
// System
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// Directly add - Objective-C
#import "EaseUI.h"
// Cocoapods - Objcetive-C
@import MJRefresh;
You can refer to this issue in Github and this question.
这篇关于警告:模块中的Swift错误.该模块中的调试信息将在调试器中不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!