Objective-C Rookie Mistake with NSArray
July 27, 2009
So far, I am very impressed with XCode and Interface Builder. What you would pay for to develop in on Windows Machines (Visual Studio), Apple gives away for free as part of the Operating System. How cool is that?!
I ran into my first debugging situation tonight where I couldn't figure out
why my little sample/learning app was crashing. I was getting a
EXC_BAD_ACCESS error message in the debugger on an
call. It turns out one of the strings in my list was not prefixed by the
So, I had:
NSArray *array = [[NSArray alloc] initWithObjects: @"Patrick", "Amy", @"Joshua", nil];
When I should have had:
NSArray *array = [[NSArray alloc] initWithObjects: @"Patick", @"Amy", @"Joshua", nil];
While the syntax is bit clunkier when primarily used to developing in Python, IDE and the depth and breadth of the Cocoa APIs are pretty insane. I feel like I am going to more be gluing stuff together, rather than writing software.