NSLog()
function to do good old fashioned printf()
-style debugging.Sometimes you need to test your code on a real device that's detached from your development system because you're testing out in the field or you're working with the External Accessory Framework and you need use the 30 pin connector to talk to the accessory. Fortunately the Xcode Organizer provides you with some help here.
You've no doubt used the Summary tab to set up your development devices. There's a few more goodies here you might not have noticed (I hadn't until recently). The Crash Logs tab, while not as informative as the debugger, can at least show you the call stack at the time your app crashes, along with method names, file names and line numbers.
The crash log information can be a bit overwhelming if you're not used to it, but it's worth spending a few minutes looking closely at it if you're trying to diagnose a crash.
The Console tab can be just as confusing at first, but shows you not only the
NSLog()
output from your app but handy system messages as well.The Console seems to only store a couple of hundred log messages, so don't go crazy with
NSLog()
, but it can be incredibly handy in narrowing down or confirming the cause of a crash when your device is not connected to Xcode.
No comments:
Post a Comment