10

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

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.

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!

2 Answers 2

9

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

Sign up to request clarification or add additional context in comments.

1 Comment

And if that still doesn't help, try to set a breakpoint on the write system call (is there any other way to write to a tty-connected fd?)
1

There's a plugin LinkedLog for that. You replace all NSLogs with LLogs and then will be able to just tap on link in Xcode's console to get to the line caused it to appear.

enter image description here

Didn't try it myself, but definitely will.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.