Hamish Rickerby

Technology Consultant & iOS Developer based in Sydney, Australia

Error on Line 1987

| Comments

I am having a bit of a play with the cocos2d game engine for iPhone and encountered a very strange error in the console - I don’t believe it’s at all related to the game engine itself, so it’s just coincidence that I was trying something new out.

error while killing target (killing anyway): warning: error on line 1987 of “/SourceCache/gdb/gdb-962/src/gdb/macosx/macosx-nat-inferior.c” in function “macosx_kill_inferior_safe”: (os/kern) failure (0x5x)

I figured out that it had to do with definition of a selector… Naughty code below.

1
2
3
MenuItem *start = [MenuItemFont itemFromString:@"Start Game"
                                        target:self
                                      selector:@selector(startGame)];

The problem is that the method name inside @selector() MUST have a colon on the back of it.

Good code

1
2
3
MenuItem *start = [MenuItemFont itemFromString:@"Start Game"
                                        target:self
                                      selector:@selector(startGame:)];

Hope that’s useful to someone.

Comments