如何打印 BOOL
How to print BOOLs
我想在没有任何编译器警告的情况下打印 BOOL(记录为带符号的字符):
NSLog(@"Parsing Result = %hhd", parsingResult);
// inside some iOS program. Xocde 6
但我得到 "Format specifies type 'char' but the argument has type 'BOOL' (aka 'bool')"。
NSLog(parsingResult ? @"YES" : @"NO");
我想在没有任何编译器警告的情况下打印 BOOL(记录为带符号的字符):
NSLog(@"Parsing Result = %hhd", parsingResult);
// inside some iOS program. Xocde 6
但我得到 "Format specifies type 'char' but the argument has type 'BOOL' (aka 'bool')"。
NSLog(parsingResult ? @"YES" : @"NO");