Have you ever tried debugging Swift code in an embedded framework, and met resistance from lldb in the form of a cryptic AST context error?
error: in auto-import: failed to get module 'RSAppKit' from AST context: <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/RSAppKit.h" ^ error: [...]/RSAppKit.h:1:9: error: 'RSAppKit/SomeHeader.h' file not found #import <RSAppKit/SomeHeader.h> ^ error: could not build Objective-C module 'RSAppKit'
After hours of trying to unravel this mystery, I discovered the root cause: the framework that is embedded in my app does not, in fact, contain any headers. They were stripped by Xcode when it copied the framework into the app.
In my opinion, Xcode and/or lldb should be smart enough to handle this situation, by preferring the version of the framework in the “Built Products” directory, which still has its header files in-tact. Radar #31502879 requests this, hopefully Apple will fix it.
In the mean time, you can work around the problem by setting the “REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES” build setting to NO in the app that embeds the framework:
You probably want to make sure it remains set to YES for Release builds, so that you don’t ship your framework’s header files to your customers.