Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: Swift error in module. Debug info from this module will be unavailable in the debugger

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.

My app has been around since before Swift. I used the bridging header to start using Swift, and I recently used the Xcode tool to migrate all the Swift 2 files to Swift 3. (but I still have obj-c legacy in there). I use cocoapods, which may be contributing to the problem.

no debugger information...

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

I tried removing duplicate imports from my swift project. In fact if I run find . -name "*swift" | xargs grep "import" 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.

So...

  • Is there another solution to this problem?
  • Is there a way to get a more detailed error message?
  • Is it a problem to have duplicate headers in the my bridging header? For example, a lot of my obj-c files import UIKit, and I include a few of those files in the bridging header.
like image 301
Johnny Z Avatar asked May 31 '17 16:05

Johnny Z


People also ask

How do I enable debug mode in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.

What is debug in Swift?

The Swift REPL can be used for debugging, to test and interact with your app. When code breaks, typing repl into LLDB will allow you to interactively test code. You can call methods with different arguments, and test new functions by adding them to your existing code.

How do I debug a module?

Simple debugging The easiest way to run a debugger in a module, either local or remote, is to use epdb. Add import epdb; epdb. serve() in the module code on the control node at the desired break point. To connect to the debugger, run epdb.

How do I debug a Swiftui preview in Xcode?

Rather than ctrl-clicking on the preview Play button, do a long click on it. That brings up the Live Preview/Debug Preview menu.


1 Answers

Just now I have encountered this problem. This is my solution:

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.

like image 90
Desgard_Duan Avatar answered Sep 20 '22 19:09

Desgard_Duan