Xcode debugger sometimes doesn't display variable values?

后端 未结 19 2223
醉话见心
醉话见心 2020-12-14 13:54

This happens to me pretty often. For example, right now I have the debugger stopped at a breakpoint in a method . . . and it isn\'t displaying any variable values at all.

19条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 14:34

    I had this issue (using Swift), I spent ages crawling through my git commits to find where to problem started.


    For me, I was using Facebook Tweaks library, but I was (unnecessarily) importing it from my project-bridging-header.h file.

    Once I got rid of it, I got my debugging back.

    for example, in my bridging header I had:

    #ifndef PROJECT_Bridging_Header_h
    #define PROJECT_Bridging_Header_h
    // Facebook Tweaks
    #import "FBTweak.h"
    #import "FBTweakStore.h"
    #import "FBTweakCategory.h"
    #import "FBTweakCollection.h"
    #import "FBTweakViewController.h"
    #import "FBTweakShakeWindow.h"
    #endif
    

    I removed all the imports and just imported it as usual in my AppDelegate import Tweaks.

    e.g:

    #ifndef PROJECT_Bridging_Header_h
    #define PROJECT_Bridging_Header_h
    // Removed Facebook Tweaks
    #endif
    

    and in my AppDelegate.swift

    import Tweaks
    

    This fixed all my debugging issues, everything works as expected and I can also using Facebook Tweaks.

    Note: I don't think this is an issue with Facebook Tweaks itself, you may have some other library causing the same issue. The idea is to remove things from your bridging-header one by one and see if you can narrow down the issue.

    I think I read somewhere that if a library is causing many issues behind the scenes, this can stop your debugger working.

    If this doesn't help, try crawling through your git commits and see at what stage the debugging stopped.

    other similar issues on SO:

    Xcode Debugging not showing values

    Xcode debugger doesn't display variable information after installing CocoaPods Podfile

    If you're having similar issues hope this helps!

提交回复
热议问题