I’m using an action in cocos2D that calls a method and passes a BOOL as an parameter.
I get the warning: “Passing argument 3 of ‘actionWithTarget:selector:data:’ makes pointer from integer without a cast” with this line:
id actionCharacterReaction = [CCCallFuncND actionWithTarget:self selector:@selector(characterReaction : data:) data:flipChar];
I’ve tried:
id actionCharacterReaction = [CCCallFuncND actionWithTarget:self selector:@selector(characterReaction : data:) data:(BOOL)flipChar];
My method looks like this:
-(void) characterReaction:(id)sender data:(BOOL)flipChar {
*code stuff inside*
}
It still seems to work fine. I’m just annoyed by the warning. Any ideas?
You are going to need to wrap you
flipCharin anNSNumberto pass it as a reference properly. When using selectors you can not pass primitive types directly.Edit: after briefly looking at the documentation it looks like it takes a
void*. Sincevoid*can be any object, not just an Objective-C object, so you will likely need to manually retain and release the number. Code above is updated.