Tyrel Van Niekerk Tyrel Van Niekerk - 1 year ago 115
iOS Question

Write debug messages to Xcode output window

I have see this in sample objective c code before, but can't find it now and all the searches come back with irrelivent results.

I want to write debug messages to the Xcode output window. What's the command to do that? Basically like System.Diagnostics.Debug.WriteLine for C#.

Answer Source
NSLog(@"Your message here");

...should do it.

To include data from variables you can use string formatting, e.g:

NSLog(@"Value of string is %@", myNSString);

There are a bunch of different string format specifiers, you can look at them here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download