NSLog是否可以只传递我传递的字符串,而不是其他信息?

Nor*_*der 0 xcode objective-c nslog

的NSLog(@ "例如");

将输出:

2012-09-13 04:54:48.128 MyApp [94652:a0f]:例子

在控制台上.

有没有办法让我只能输出:

bry*_*yle 5

如果您定义此宏并使用它而不是NSLog,它将只输出您指定的内容.

#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
Run Code Online (Sandbox Code Playgroud)