Swift debugger does not show variable values when importing ObjC framework

后端 未结 6 1660
灰色年华
灰色年华 2020-12-02 20:11

When I create a new OS X \"Game\" project with Sprite Kit, and set a breakpoint anywhere I can see the variable values just fine:

相关标签:
6条回答
  • 2020-12-02 20:42
    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.

    0 讨论(0)
  • 2020-12-02 20:48

    Go to Edit Scheme on left top corner.

    And change the configurations to Debug, if it is release here

    0 讨论(0)
  • 2020-12-02 20:50

    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.

    0 讨论(0)
  • 2020-12-02 20:53

    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.

    0 讨论(0)
  • 2020-12-02 20:56

    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).

    0 讨论(0)
  • 2020-12-02 21:00

    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.

    0 讨论(0)
提交回复
热议问题