通常在 lldb 调试器中,如果你对一个对象执行 po,它的地址也会与描述一起显示。但是,如果是 NSString,则不会显示地址。所以问题是有没有办法看到它。
PS - 源代码中的 NSLog %p 不是我要找的答案。
最佳答案
简单的用“p”代替“po”。
示例:
NSString *string1 = @"test 1";
NSString *string2 = @"test 2";
(lldb) po string1
测试一
(lldb) p string1
(NSString *) $2 = 0x0000000100003af0 @"test 1"
(lldb) p string2
(NSString *) $3 = 0x0000000100003b10 @"测试 2"
关于xcode - 如何在 Xcode Debugger 中打印 NSString 的地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21311634/