po Swift String “unresolved identifier”

后端 未结 2 1545
误落风尘
误落风尘 2020-12-31 02:50

I am having trouble debugging Swift Strings

func stringTest() {

    let test1:String =   \"test1\";
    let test2:NSString = \"test2\";

    // <-- Break         


        
相关标签:
2条回答
  • 2020-12-31 03:36

    This is most likely a bug in the debug information output. You can check this by grabbing the PC, for instance from register read pc, and then doing:

    (lldb) image lookup -va <PC VALUE>
    

    That will print a bunch of stuff, but the last entries will be all the variables currently visible to the debugger, and where they live (in registers or memory.) If you don't see the variable there, then the debug information must have told lldb that the variable is not currently live.

    If you can reproduce this in some example code you can make available, please file a bug with bug reporter.apple.com.

    0 讨论(0)
  • 2020-12-31 03:36

    It is a bug of Beta. Xcode6-Beta5 has still this bug. You can only get debug info for swift's variables, but can't get it for swift's constants. Temporarily you can change let test1 to var test1 and you will got debug info. Hope this will be fixed in release version. Good Luck in debugging ;)

    EDIT: Unfortunately, the same issue is still happening in first release of Xcode Version 6.0.1 (6A317)

    let test1:String  -> debug info is unavailable
    var test1:String  -> debug info is available
    

    EDIT2: Yes, confirmed. It is fixed also for iOS apps in the latest Xcode 6.1 under OS X Yosemite.

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