Is there a format specifier that works with Boolean values?

后端 未结 6 1717
悲&欢浪女
悲&欢浪女 2021-02-12 14:17

I want to do something like this:

NSLog(@\"You got: %x\", booleanValue);

where x is the specifier. But I can\'t find one! I want to avoid:

6条回答
  •  一生所求
    2021-02-12 14:23

    For os_log use

    os_log("results in true/false: %{bool}d", myBool)
    os_log("results in YES/NO: %{BOOL}d", myBool)
    

    If you are on the latest OS, you can also use string interpolation. For more info look at Format Custom Values in Message Strings

提交回复
热议问题