Book Image

Xcode 4 Cookbook

By : Steven F. Daniel
Book Image

Xcode 4 Cookbook

By: Steven F. Daniel

Overview of this book

<p>The release of iOS 6 comes packed with over 1,500 new APIs and 200 new features. Xcode 4 Cookbook will teach youhow to integrate iCloud storage and how to go about using the Facebook and OpenGraphi APIs, as well as providing you with practical step-by-step recipes covering User Interfaces, data management, multimedia, localisation services and maps, right through to application deployment to the Apple App Store. You will soon be mastering the technology and the skills needed to create some amazing applications.<br /><br />"Xcode 4 Cookbook" will help you learn how to build some powerful applications using iOS 6 and the various frameworks. You will soon master how to incorporate iCloud, Facebook, and the OpenGraph APIs and apply various image filters and transitions using Core Image integration within your applications. By using the book’s step-by-step approach, you will soon master the technology and the skills needed to create some amazing applications.<br /><br />"Xcode 4 Cookbook" provides you with the skills and knowledge and practical recipes on how to go about developing useful applications that can be used within the industry.<br /><br />You will start by learning how to go about downloading and installing the Xcode Development Tools, learn about Interface Builder to create the visual user interfaces, connecting the objects using Outlets and Actions, and learn how to compile/debug your applications.<br /><br />Finally, you will learn how to capture media with the iOS camera and play back video content using Airplay to wirelessly stream videos to an Apple TV device, using the AV Foundation framework, as well as using the Core Image and Core Graphics frameworks to create amazing image effects using the built-in features.</p>
Table of Contents (19 chapters)
Xcode 4 Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Debugging your iOS applications using Xcode


In this recipe, we will show how easy it is to debug applications within Xcode and the iOS Simulator.

Getting ready

Xcode 4, provides you with a debugger for debugging your applications either using the iOS Simulator or on the actual iOS device. In this recipe, we will see how easy it is to debug applications to debug our HelloWorld application.

How to do it…

Debugging your application using the Xcode development environment is a simple process, and allows you to monitor changes to your application variables, as well as stepping through your source code line by line, and can be achieved by performing the following simple steps:

  1. Open the ViewController.m implementation file from the project navigator.

  2. Next, locate the btnTapHere event method and place a breakpoint within the gray gutter, as shown in the following screenshot.

  3. You will notice that an arrow appears at the line you placed the marker at.

  4. Next, build and run the application by selecting Product | Run from the Product menu, or alternatively by pressing command + R.

  5. Populate the Firstname and Surname fields, and click on the Tap Here button.

  6. You will notice that execution of our application has paused, and the debugger has stopped at the line where we placed our breakpoint.

  7. Hover the mouse over the greeting variable in the breakpoint line to see the contents of the greeting label.

  8. To continue execution of your application, click on the Continue program execution button.

How it works…

Although you can use the debugger to pause execution of your program at any time and view the state of your program variables, it is better to set the breakpoints before you run your application.

A breakpoint is basically an instruction that tells the application to stop when the breakpoint has been reached. During this phase, the execution of your code pauses and waits for further instructions as to what to do next. During this phase, you have the opportunity to either inspect the current values of any of the properties, or step through the code.

See Also