How to find source of print() or NSLog() console output in Xcode
I'm not sure if this is possible. Here is an example situation:
Something is printing to my console a开发者_运维百科nd 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.
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.
Also: are there other functions that print besides NSLog and print?
Thanks so much!
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
There's a plugin LinkedLog for that. You replace all NSLog
s with LLog
s and then will be able to just tap on link in Xcode's console to get to the line caused it to appear.
Didn't try it myself, but definitely will.
精彩评论