Viewing NSData contents in Xcode

前端 未结 12 1979
我在风中等你
我在风中等你 2021-01-31 09:51

I am running Xcode and I would like to dump out a NSData*. The variable in question is buffer. Is there a way to do this through the UI or the GDB debugger?

12条回答
  •  野的像风
    2021-01-31 10:40

    Xcode 11.4 (and probably earlier) supports examining the raw bytes of (NS)Data in the visual debugger. Set a breakpoint after the Data has been assigned, hover over the symbol until the popup appears, and click on the eye or info icon. Roll for dexterity to prevent the popup from closing on you by moving outside of the tiny target.

    Tested with Swift but presumably works with C family languages, too.

    (Note: the eye icon produces the output below which is nicely formatted but, uh... seems to be missing the final column of bytes?)

提交回复
热议问题