如何在 Xcode 中找到 print() 或 NSLog() 控制台输出的来源 [英] How to find source of print() or NSLog() console output in Xcode

查看:106
本文介绍了如何在 Xcode 中找到 print() 或 NSLog() 控制台输出的来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可能.下面是一个示例情况:

I'm not sure if this is possible. Here is an example situation:

有些东西正在打印到我的控制台,我不知道它来自代码的哪里.我使用 Xcode 中的 Finder 对NSLog"和打印"等术语进行了快速搜索.没有相关的东西出现.

Something is printing to my console and I don't know where it is coming from in the code. I did a quick search using the Finder in Xcode on terms such as 'NSLog' and 'print'. Nothing relevant came up.

Xcode 有没有什么快速的方法可以找到输出的来源?

Is there any quick way that Xcode has of finding where the source of the output is coming from ?

有点像当您右键单击一个方法时,您可以使用所有选项来探索与该方法相关联的代码的不同部分.

Kind of like when you right click on a method and you have all the options of exploring different parts of the code associated with that method.

另外:除了NSLog和print之外还有其他的打印函数吗?

Also: are there other functions that print besides NSLog and print?

非常感谢!

推荐答案

尝试在调试器中运行,在 printf、NSLog 等上设置断点.当您遇到断点时,请执行回溯 (bt) 以查看从哪里调用它

Try running in the debugger, with breakpoints set on printf, NSLog, etc. When you hit a breakpoint do a backtrace (bt) to see where it's being called from

这篇关于如何在 Xcode 中找到 print() 或 NSLog() 控制台输出的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆