What's the quickest and easiest way to view debug logs for my iPhone application? This question was actually raised by one of our clients, so I thought it would be useful to share the answer here.
As a developer, you want detailed software testing feedback from testers. This is information that you can immediately use to pinpoint the problem. Broken links, misaligned images, calculation errors, etc. These are all quite obvious.
However, testing apps on mobile devices is a different matter. Because there are so many factors involved: device OS version, whether it's jailbroken, language setting, carrier, Wifi or 3G..... the list goes on. With so many moving parts, we frequently see reports from users that something "just crashes".
Much like explaining a rattling dashboard to a service mechanic, problems like this seem to never appear when you are deliberately trying to replicate it. Plus the more desperately you try to crash something, the less likely you'll remember how to replicate it, once more.
For iPhone apps, it means it is time to fire up the debugger.
Obviously, we still want to test on the device, not simulator, for the realistic usage experience. Therefore the best way for internal testing of the iPhone app is to do so by running the app from xcode and connected to the debugger.
- To do so, connect the device to the Mac as and run as normal (debug and release builds do not make a difference in this instance)
- Build and run the app.
Command + shift + Rto open the debugger console.
Simple right? Now go ahead and mess with the app with your evil intentions, but this time all your actions are logged. If you crash the app, simply look up at the screen to see what happened.
Alternately, you could consider writing debug information directly to the user's device, then transmit it back to the developers either by prompting users that there's been a crash or transparently in the background the next time the app is launched. There are pros and cons, and that is something we'll cover in a future entry.