In Xcode 8, When any break point is hit, and I try to print any object in the Xcode debugger, it always prints "Could not resolve type". I have searched enough on the internet. I have checked if EditScheme->Run->Info->BuildConfiguration is set to 'Debug'. Build setting->Optimisation level is set to 'None'. But no clues on why this happens. Could anyone help me out here? Thanks in advance.
I just had the same problem and it had been solved.My project is a Mixed project with both OC and Swift. I found that some .h file import in my Bridging Header file that caused the problem. Definitely, an enum declared in the .h file cause the problem, like this:
typedef NS_ENUM(NSInteger,BadgeAlignment) {
AlignmentCenter,
AlignmentLeft,
AlignmentRight,
};
If i comment the code, everything goes alright.
And I just add a prefix to each element of the enum and the problem is solved for me.
typedef NS_ENUM(NSInteger,BadgeAlignment) {
BadgeAlignmentCenter,
BadgeAlignmentLeft,
BadgeAlignmentRight,
};
I just thinking if there is a conflict with some enum in Swift when convert the .h to Swift.
I'm still confused...
I encountered a similar issue with a pure swift framework that doesn't have any bridging headers but non the less had SWIFT_INSTALL_OBJC_HEADER
set to YES
It is described in more detail at https://stackoverflow.com/a/51186560/385307
After changing the setting to NO
debugging works again.
I had a similar issue with a Swift project which included an Obj-C framework. I had imported the framework in my Swift project using
import Obj-C-Framework
Additionally, I had also created a Bridging-Header file in the Swift project and included the Obj-C-Framework header using
#include <Obj-C-Framework/Obj-C-Framework.h>
This was causing the Xcode debugger to always show 'could not resolve type' when printing objects in breakpoints. Removing the #include in the Bridging-Header fixed the issue and objects print correctly in breakpoints.
TL;DR If your swift project uses an Obj-C framework make sure that the framework headers are not included in your Swift project's bridging header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With