如何打印布尔[重复](How to print BOOLs [duplicate])
这个问题在这里已经有了答案:
如何在NSLog中打印布尔标志? 11个答案我想在没有任何编译器警告的情况下打印BOOL(记录为有符号字符):
NSLog(@"Parsing Result = %hhd", parsingResult); // inside some iOS program. Xocde 6但我得到“格式指定类型'char',但参数的类型为'BOOL'(aka'bool')”。
This question already has an answer here:
How to print Boolean flag in NSLog? 11 answersI want to print a BOOL (which is documented to be a signed char) without any compiler warnings:
NSLog(@"Parsing Result = %hhd", parsingResult); // inside some iOS program. Xocde 6But I get "Format specifies type 'char' but the argument has type 'BOOL' (aka 'bool')".
最满意答案
NSLog(parsingResult ? @"YES" : @"NO"); NSLog(parsingResult ? @"YES" : @"NO");更多推荐
发布评论