Archive for August, 2008

iOS Developer Tips - Visitor Stats:
276,807 Pageviews and 214,652 visitors in the past 30 days.

For advertising information and rates, click here.

Conditional Compilation

In the previous post I used conditional compilation to enable and disable debugging messages, yet I didn’t take the time (for those new to C/Objective-C) to explain how everything worked. There are three ways to control compilation, the options are as follows: 1 2 3 #if constant-expression #ifdef identifier #ifndef identifier

Objective-C

Filename and Line Number with NSLog: Part II

In the previous post I demonstrated a simple debug class that I wrote to wrap some additional code around NSLog. The code allows for displaying additional information beyond the date/time stamp and process ID that NSLog outputs, specifically, the filename which calls the debug routine, and the line number where the call was invoked. I [...]

Cocoa

Filename and Line Number with NSLog: Part I

Coming from a C development background, long before the days of integrated debuggers, printf() was the primary tool for tracking down bugs. Building on that, NSLog is no doubt helpful. However, as the amount of code in a project grows, I often find that another reference point in the output would be helpful, namely, the [...]

Cocoa

Linking Error: Symbol Not Found

In building a recent project I encountered an error during the linking process. I want to point out the error message and show you how this simple error can be resolved. The reason for pointing out this error is that I have no idea why this error came about…more on that in a moment. Start [...]

Xcode

Linking Error: CGRectZero and CGRectOffset

I want to share another debugging tip, this something that applies to the final step of building an iPhone project, linking. I was able to successfully compile a project that I’ve been working on, however, the build process generated an error that two symbols could not be found, CGRectZero and CGRectOffset. The figure below shows [...]

Xcode

Error: syntax error before ‘AT_NAME’ token

I recently ran into this error message within Xcode while writing an iPhone application. I was surprised how long it took to track this down. One of the reasons this is tricky is that message implies that the error occurred in the file referenced in the error message. For example, in my case, I was [...]

Xcode

Where is My Object Retained?

For those new to Objective-C and iPhone development, I want to point out something that might save you some time. Look at the code below: 1 2 3 4 5 6 @interface SomeClass : UIViewController { .. UIView *containerView; … } 1 2 3 4 5 6 7 8 9 10 11 12 13 @implementation [...]

Objective-C

NSIndexPath and row method

In working with the SimpledDrillDown example in the iPhone SDK, I was walking through the code in the RootViewController class. The interface definition is shown below: 1 2 3 4 @interface RootViewController:UITableViewController { DataController *dataController; } There is a method inside the class that looks as follows: 1 2 3 4 5 6 7 – [...]

Objective-C

Alternative Use of Properties?

While scanning a few code examples inside the iPhone SDK, I bumped into something interesting. I wrote a short example to mimic what I found…take a look at the following interface declaration: 1 2 3 4 5 6 7 8 9 @interface SomeClass : NSObject { NSString *str; NSDate *date; }   @property (nonatomic, retain) [...]

Objective-C

Properties, Setters and Dot Syntax

I’ve been ramping up on iPhone development, and with the NDA still in place (as far as I know), I haven’t been able to blog about what I’ve written/learned. And with that, it’s been quiet in here. Too get back into this, let’s continue to spend some more time on Objective-C… The properties feature in [...]

Objective-C

Private Methods

One common complaint for many new to Objective-C is that the language lacks support for private methods within a class. There are compiler directives for instance variables: @private, @protected (the default) and @public. However, if you want to hide methods, there is no specific directives to help. The example here builds on the previous post [...]

Objective-C

Categories

As an alternative to subclassing, Objective-C categories provide a means to add methods to a class. What’s intriguing, is that any methods that you add through a category become part of the class definition, so to speak. In other words, if you add a method to the NSString class, any instance, or subclass, of NSString [...]

Objective-C

Initializers

The code for creating new instances of a class generally looks as follows: 1 SomeClass *ptr = [[SomeClass alloc] init]; In this case, we send a message (alloc) to the recevier (SomeClass) to create a new instance; the object returned from this message, then sends a message (init) to initialize instance variables within the class. [...]

Objective-C

TextMate and Xcode

I’ve been spending time getting familiar with Xcode as I learn to write applications in Objective-C, with the larger goal of writing applications for iPhone. My editor of choice on the Mac up to this point, is TextMate, an great all around code editor. I’ve written a number of tutorials/tips on TextMate on my Mac [...]

Xcode

Memory Management

First off, it’s worthing clarifying that much of what is covered here is as much Cocoa as it is Objective-C. However, since the two are quite closely tied when it comes to developing Mac/iPhone applications, I’ve decided to keep with the Objective-C theme as it relates to the title of this and subsequent posts. This [...]

Objective-C
All Content Copyright © 2008-2012 • iOS Developer Tips, All Rights Reserved.