Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot debug Swift module/framework embedded in Objective-C app

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.

like image 903
Richard Stelling Avatar asked Sep 13 '16 10:09

Richard Stelling


2 Answers

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.

like image 172
Tim Friedland Avatar answered Oct 17 '22 14:10

Tim Friedland


use fr v instead po for debugging

For more debugging https://www.codeproject.com/Articles/1181358/Debugging-with-Xcode

like image 11
Suresh Kansujiya Avatar answered Oct 17 '22 12:10

Suresh Kansujiya