Swift debugger does not show variable values when importing ObjC framework

ε祈祈猫儿з 提交于 2019-11-27 12:02:29

I got a message from an Apple developer stating that they've observed this problem, and that it could be fixed by moving the .framework to a subfolder of the project.

Apparently the module .. was built in directory error appears only if the .framework is in the same folder as the .xcodeproj aka $(PROJECT_DIR).

However moving the framework to a subfolder didn't fix the issue in my case, but it's still worth a try until this gets fixed in a newer Xcode 7 beta (still occurs in beta 3).

In my case this was happening because of redundant import statements in my project.

My project mixes swift and objc files, so I have import statements in the bridging_header.h file.

In my bridging_header.h I had #import blah.h

In one of the swift files, I was importing a redundant header from a framework @import blah // From blah.framework

I removed the redundant import from the swift file, that seems to have fixed it.

I can confirm this is happening in Xcode Version 7.0 beta 4 (7A165t). I had to remove my ObjC framework to get Debugging values to return. If removing your framework isn't an option, the print method is old-school debugging, but still works.

I had this issue a while ago. In my case the Prefix.pch was beeing included inside the Bridging-Header.h. This is not a issue per so, but inside my Prefix.pch there was many C includes that make the lldb fail to import the Bridging-Header. So I removed the "#import Prefix.pch" from the Bridging-Header and copied just the "#includes" to the obj-c files that I need to use in swift.

  1. The Optimization level is not set to None for the Debug configuration. Be sure to set it to None for Objective-C apps as shown in Figure 1 and for Swift apps as shown in Figure 2.

  1. The Build Configuration pop-up menu is set to Release in the scheme editor's Run action settings pane. In Xcode, open the scheme editor by choosing Product > Scheme > Edit Scheme…, select the Run action for your app in the scheme actions pane, then set Build Configuration to Debug as seen in Figure 3.

Go to Edit Scheme on left top corner.

And change the configurations to Debug, if it is release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!