$aleOrigin

Debugging

Please consider subscribing to Mobile Developer Tips
RSS feed or following us on Twitter


Tracking Down Exception Errors With objc_exception_throw

When an application throws an exception, there is debug information shown in the console – below is the output in the console for an NSInvalidArgumentException: Although helpful, depending on the size of your application, it may take quite some time to find the offending code. One way to better track exceptions is to catch them, [...]

Debugging

Remove Debug Code For Release Build

When it’s time to remove debug code and log messasges from your application, it’s straight forward if you follow a few simple steps during development. First, wrap debugging code in a block similar to the following: #ifdef DEBUG // Debug code here… #endif From the Edit Scheme dialog select the Run tab. In the Info [...]

Debugging

Debugging with GDB: Print-Object and UIView recursiveDescription

In the post Debugging with GDB: Introduction to Commands, Print and Print-Object I covered the basics of the command line inteface in GDB. In this post I’ll show you a trick to print out the entire view hierarchy for UIView objects. In Objective-C, all objects (derived from NSObject) have a description method, which returns an [...]

Debugging

Updated: Tracking Down EXC_BAD_ACCESS Errors with NSZombieEnabled in Xcode 4

In a previous post Tracking Down EXC_BAD_ACCESS Errors with NSZombieEnabled I explained how the environment variable NSZombieEnabled can help track down EXC_BAD_ACCESS errors, which are typically caused by attempting to access objects that have already been released. With Xcode 4 the process for setting NSZombieEnabled is different than in earlier versions of Xcode. To configure [...]

Debugging

Debugging with GDB: Introduction to Commands, Print and Print-Object

GDB is the debugging system built into Xcode. Xcode handles much of the interaction with GDB to provide support for breakpoints, stepping through/over code, wowever, GBD also provides a command line that you can use to work directly with the debugger. This tutorial walks through the basics of the command line interface along with an [...]

Debugging

Objective-C Expressions for Debugging

In a previous post I wrote about preprocessor macros that provide filename, line number and function information to aid in debugging. A short example follows: – (void)buttonPressed:(UIButton *)button { NSLog(@"\n Function: %s\n Pretty function: %s\n Line: %d\n File: %s\n Object: %@", __func__, __PRETTY_FUNCTION__, __LINE__, __FILE__, button);   … }

Debugging

Xcode 4 : Debug Breakpoints, Conditions and Actions

I recently bumped into a few new debugging features in Xcode 4 while looking at breakpoint options. To show how this works, let’s look at a small block of code where I’ve already set a breakpoint by clicking in the margin area on the left side in the editor:

Debugging

Locating Crash Reports

If an applications crashs while running on a device, iOS logs the errors and creates a crash report. The report includes specifics about the OS version, date/time, the exception type, a stack trace, among other details. Below is a partial listing of a report:

Debugging

Share and Copy Files Between an App and iTunes

You can share files between an iOS app and your Mac using file sharing via iTunes. Using file sharing the contents of your application’s Documents directory is available in iTunes. This also works the other way, where you can place files from your Mac into the shared area of iTunes and make them available to [...]

Debugging
All Content Copyright © 2008-2012 • Mobile Developer Tips, All Rights Reserved.
iPhone and iPad are registered trademarks of Apple, Inc.
iOS is a registered trademark of Cisco Technology, Inc.