Archive for August, 2008
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
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 [...]
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 [...]
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 by [...]
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 the specific [...]
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 looking [...]
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 SomeClass
…
- (void)loadView
{
…
UIView *uiView = [[UIView alloc] initWithFrame:
[[UIScreen mainScreen] applicationFrame]];
self.containerView [...]





