When writing Objective C code, never forget to have your init method return self or bad things will happen, but maybe not in a debug build. I wasted over an hour on that today when my debug build worked perfectly but a release build crashed in awakeFromNib where it was initializing a series of items for a TabView. One of them had an init method that looked like this:
- (id)init
{
if (self = [super init]) {
[self loadStateNames];
}
// oops - I forgot something here
}
For some mysterious reason it didn’t fail in a debug build, and I couldn’t place a breakpoint to debug a release build, so I had to resort to “ghetto debugging” using CFShow. Instead of a panel object, I was seeing an array of state names! Adding return self; cured it.