This question already has answers here:
Why can't LLDB evaluate this expression?

(4个答案)


7年前关闭。




为什么不起作用?
(lldb) po [NSString stringWithFormat:@"%f", 1.0]
error: too many arguments to method call, expected 1, have 2
error: 1 errors parsing expression

但这确实是:
(lldb) p (void)printf("%f", 1.0)
1.000000

LLDB不支持Objective-C变量参数语法吗?

最佳答案

正如Martin R在评论中指出的那样,它显然是general LLDB issue with variable argument lists

另一方面,作为Patrik Schmittat pointed out-initWithFormat:可以正常工作:

(lldb) po [[NSString alloc] initWithFormat:@"%f", 1.0]
1.000000

我已经为此提交了雷达:rdar://15261415 (stringWithFormat not working in LLDB)

关于ios - stringWithFormat在LLDB中不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19448101/

10-13 05:03