@selector(takeTurnHostile)
should be
@selector(takeTurnHostile:)
because your selector takes an argument, and the colon is part of the selector name.
Question
Okay guys... Hopefully this will be another quickie.
I have a class MonsterView, extending UIImageView, extending NSObject.
I have declared a MonsterView pointer called myMonster that contains an object of class MonsterView and looks something like this...
MonsterView* myMonster = [monsterArray objectAtIndex:0];
Now the pointer myMonster points to an object of class MonsterView.
I have a method like:
-(void) takeTurnHostile:(MonsterView*) monster
{
// Do Stuff
}
I want to call this method by using performSelector... Like THIS:
[self performSelector:@selector(takeTurnHostile) withObject:myMonster afterDelay:0.1];
The bloody machine will not have any such nonsense. Why in the name of all that is good and holy can't I do this?
More importantly, how -COULD- I do this?
Thanks, guys! J-Rock
Solution
@selector(takeTurnHostile)
should be
@selector(takeTurnHostile:)
because your selector takes an argument, and the colon is part of the selector name.
OTHER TIPS
Missing colon in the selector...
[self performSelector:@selector(takeTurnHostile:) withObject:myMonster afterDelay:0.1];
it should be @selector(takeTurnHostile:)
. You've forgot the colon
As H2CO3 said you must provide the colon:
takeTurnHostile:
The colon indicates that the method you are calling has 1 parameter. Currently without the colon you are saying to run the method:
-(void) takeTurnHostile
{
}