【问题标题】:Is it possible to NSLog only the string that I pass, not the other info? [duplicate]是否可以仅 NSLog 我传递的字符串,而不是其他信息? [复制]
【发布时间】:2012-09-07 06:38:56
【问题描述】:

NSLog(@"example");

将输出:

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

在控制台上。

有没有办法让它只输出:

例子

【问题讨论】:

标签: objective-c xcode nslog


【解决方案1】:

如果你定义了这个宏并使用它而不是 NSLog 它只会输出你指定的内容。

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

【讨论】:

  • 谢谢!对了,我也找到了this的解决方案。
  • 如何在 Swift 中做同样的事情?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-16
  • 2018-04-16
  • 1970-01-01
  • 1970-01-01
  • 2016-08-23
相关资源
最近更新 更多