This line of code works perfectly
[self explodeBomb:obj];
but if I replace it with the following line, I get an NSInvalidArgument Exception, with the reason being an unrecognized selector.
[self performSelector:@selector(explodeBomb) withObject:obj ];
The definition of the method is as follows:
-(void)explodeBomb:(SKNode *)bomb
I know, this has to be me not understanding something fundamental. But why I am able to call the method directly with no problems, but when I try to use the performSelector
it blows up? For the record obj is defined as an ID. I tried changing the signature of explodeBomb to take an ID and then explicitly cast it inside the method, but that threw the same exception. Anyone know what the heck I am doing wrong?
Use
:
and write like belowSince your method
explodeBomb
has an argument so you have to specify: