Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stringWithFormat not working in LLDB [duplicate]

Why doesn't this work?

(lldb) po [NSString stringWithFormat:@"%f", 1.0]
error: too many arguments to method call, expected 1, have 2
error: 1 errors parsing expression

But this does:

(lldb) p (void)printf("%f", 1.0)
1.000000

Is Objective-C variable arguments syntax not supported in LLDB?

like image 965
Ortwin Gentz Avatar asked Oct 18 '13 11:10

Ortwin Gentz


1 Answers

As Martin R pointed out in the comments, it's apparently a general LLDB issue with variable argument lists.

On the other hand, as Patrik Schmittat pointed out, -initWithFormat: works just fine:

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

I've filed a radar for this: rdar://15261415 (stringWithFormat not working in LLDB)

like image 162
Ortwin Gentz Avatar answered Oct 26 '22 22:10

Ortwin Gentz