01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

278 CHAPTER 14 Debugging techniques<br />

14.2 Understanding NSLog<br />

In this book you’ve utilized the NSLog function extensively to emit diagnostic messages<br />

to the Xcode debugger console window. What you may not realize is that NSLog continues<br />

to log messages even when your application is used outside of the debugger. It<br />

even logs messages once a user purchases your application from the iTunes App Store<br />

and runs it on their own device. Where do these log messages end up, and how do you<br />

retrieve them?<br />

To answer these questions, deploy the DebugSample application onto your real<br />

iPhone or iPad device, and run the application a couple of times (see appendix A for<br />

details if you haven’t done this before). When you reconnect the device to your computer,<br />

you can bring up the Xcode Organizer window (Shift-Cmd-2), which should<br />

look similar to figure 14.2.<br />

This window can be used for a wide range of tasks, such as uninstalling applications,<br />

maintaining device provisioning profiles, and capturing application crash reports or<br />

screenshots. In this case, you want to be in the Console section, as shown in figure 14.3.<br />

Figure 14.2 The Xcode Organizer window showing a list of connected iOS devices. Using the various<br />

tabs, you can control different aspects of your connected device, such as installing and uninstalling<br />

applications, maintaining provisioning profiles, capturing screenshots, and reviewing application<br />

crashes and log files.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!