Reputation: 39283
NSArray arrayWithObjects needs nil at the end, NSString stringWithFormat and NSLog() doesn't. Why?
[NSArray arrayWithObjects:<#(id), ...#>, nil]
[NSString stringWithFormat:<#(NSString *), ...#>]
NSLog(<#NSString *format, ...#>)
Upvotes: 0
Views: 547
Reputation: 28242
Because -stringWithFormat:
and NSLog
can infer the number of arguments based on their format strings (the first argument). -arrayWithObjects:
can't.
Upvotes: 4