Weird behaviour of Xcode 11 Debugger - Showing values as nil when there's a value

后端 未结 2 1035
抹茶落季
抹茶落季 2020-12-07 02:02

I just noticed weird behaviour of Xcode11, I am executing same code in Xcode 10 and Xcode 11.

See the below attached screenshot for both the versions.

I am c

2条回答
  •  星月不相逢
    2020-12-07 02:40

    This is a known bug, affecting LLDB (the Xcode debugger) as well as the REPL. It's purely a matter of display:

    https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11593

    https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11546

    And see:

    Instantiated optional variable shows as nil in Xcode debugger

    An easy workaround for now is to pass thru the bridged Objective C type. The bug is only with the Swift Foundation overlay type. So in this case just cast to NSURL.

    So for example:

    But:

提交回复
热议问题