How to I Develop and Test using Test Driven Development (TDD)?

Test Driven Development (TDD) was a topic at one of the iOS Coders meetings. The presentation is on our Knowledge Base site, here: Test Driven Development in iOS.


How do I create a drawer like in the Facebook App?

Using a drawer is pretty common in iOS apps today. It’s a simple way to create an icon in the upper left corner of the screen which reveals a list of things you can do with the app. Facebook was one of the first apps (I know of) to do this. It’s similar to the pop up controller introduced on the iPad.

The MMDrawController open source project is a very good package.  It is installed a library using the CocoaPods project.  The iOSCoders App uses CocoaPods.

How do I distribute apps over the air?

Normally you will use Xcode to install apps on your iOS device or test using the simulator. It’s also possible to install your app from a website. This is typically used to distribute apps to a team for testing or for enterprise distribution. Sometimes I’m testing my apps and I need to delete it and reinstall it. Other times I have the app on the app store an I want to download the latest released version These are situations when I post the app to a website and download it.

You can do this too by following the “Installing Apps from a Website Tutorial“.

How do I Setup a Web View?

The easiest way to setup a web view is to use PhoneGap. iOS developers consider this “cheating” to some extent. Using a WebView alone does limit the ability to take advantage of native functionality, however, PhoneGap provides plugins to access most  features via JavaScript extensions.

The plugins can be somewhat challenging to install, but if you are just creating iOS apps, you’ll only incur the challenge once. Besides, if you are familiar with iOS already, figuring out how to install a plugin is a little easier.

If you are really a die hard native developer, here’s use my simple project to get the job started.

git clone


How do I use the debugger?

Click here to access the Apple documentation for the Xcode debugger. Running your project using Command+R starts the simulator or runs the app on your iOS device. The build configuration must be set to Debug. Use the Command+< keys to bring up the options screen, click on the Run target, then select Info. The dropdown for Build Configuration should be set to Debug. Click next to the line of code to set a breakpoint. You will see a blue arrow. After running the program, when the breakpoint is reached the debugger console will be shown. (Use Shift+Command+C to display it or Shift+Command+Y to hide it). The Debug Navigator will displayed showing the call stack. The Debugger console will show the variables on the left and a command prompt on the right.

The most handy thing to do in the debugger is inspecting variables. This is easily accomplished by using the “expr” command. For instance, to see the value of variable i, just enter “expr i”. You can also change variables, for instance “expr i++” will increment i. Most variables are actually pointers in Objective-C, therefore you must use * to see the contents of the object.

For example:

(lldb) expr *c
(CardClass) $4 = {
    NSObject = {
        isa = CardClass
    _suit = Diamonds
    _faceUpDown = FACE_DOWN
    _value = 1


You can also follow a bunch of pointers using “expr -P 10 — c” for instance.

Often times, logging messages as the app runs is the best way to debug. Use the following code to print functions as they are executed works well, and it is disabled when the build scheme is changed to “Released”.

-(id)yourmethod {
    #ifdef DEBUG
    NSLog(@"%s", __func__);

The official documentation for the debugger is at

One of the most useful breakpoints to set is “Debug/Breakpoints/Create Exception Breakpoint…”, this will help you find problems like trying to put “nil” into an NSArray or sending the wrong message to a class.

Assert is your friend, use this function call to force an exception so you can examine the call stack if something goes awry. It’s best to avoid using asserts in production code, therefore this construct is best:

#ifdef DEBUG
    NSLog(@"%s", __func__);
    assert(self.gameState == NotStarted);