gpt4 book ai didi

xcode - 如何在 Xcode Debugger 中打印 NSString 的地址

转载 作者:行者123 更新时间:2023-12-02 06:35:11 25 4
gpt4 key购买 nike

通常在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com