Alternative titles (to aid searching)
- Cannot debug Swift 2.3 framework linked to an Objective-C app in Xcode 8
error in auto-import: failed to get module 'XYZ' from AST context
Xcode 8- Xcode 8 cannot debug Swift framework
warning: Swift error in module <XYZ>
- Workaround for; Xcode Debugger cannot debug apps written in Objective-C only but that link against frameworks written in Swift only. (28312362)
I have an app written in Objective-C that links against some modules (frameworks) written in Swift 2.x.
Question
Everything (debugging etc.) works fine in xcode7, however when moving to xcode8 and updating the modules to use swift2.3 I was unable to debug the modules.
LLDB reported these errors:
warning: Swift error in module XYZ.
Debug info from this module will be unavailable in the debugger.
error: in auto-import:
failed to get module 'ABC' from AST context
This does not happen if I link the modules to an app built in Swift 2.3.
For me it was just as simple as it was painful and time consuming:
import SDWebImage
was the PROBLEM, because one of the frameworks had the SDWebImage already packed in it(and I couldn't see it), and that framework happened to be Objective-C, and the app was Swift. I also added the SDWebImage to the project, because I use it in the classes I write, and that what created the mess the xCode debugger couldn't deal with. So basically, make sure you don't have ANYTHING duplicated in ANY way, I'd check for common things like SDWebImage for example.In my case, I had to remove
Objective-C Bridging header
from build settings file. My Bridging header file did not do anything.. so it was okay.I ran into this when building a framework with Carthage. Trying to debug would print the error, which referenced an Obj-C framework dependency.
I found this blog post which suggested adding a the following user-defined build setting to my project:
For Debug:
REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES = NO
For Release:
REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES = YES
This fixed the issue for me.
Try to restart Xcode. In my case it resolved an issue.
I just took 2 days for me to resolve and debugging through print command all the time. Now I got the issue:
My project is in Swift and I was using objective-C library same as imported in pods for swift(old Objective-C project merged in this one) and was using import IQKeyboardManager as well as import "IQKeyboardManager.h" header as well. That conflicts and deleting the header one resolved my issue finally. You can check with this type of duplicity in libraries.