Viewing NSData contents in Xcode

前端 未结 12 2147
我在风中等你
我在风中等你 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:31

    No one has ever correctly answered the question. After 2 years I think it's time for one :)

    Assuming you have in your code

    NSData* myData;
    

    Then in lldb you type

    me read `[myData bytes]` -c`[myData length]`
    

    If the format of the dump is not to your liking you can add '-t ' for example

    me read `[myData bytes]` -c`[myData length]` -t int
    

    For more help type

    help me read
    

    in lldb

提交回复
热议问题