My application crashes when these blocks of code are executed. There are no errors, just warnings. The warning says, “Conflicting return type in implementation of ‘ccTouchesBegan:withEvent’:’void’VS’BOOL'(aka ‘signed char’)” Please help.
-(BOOL) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
return YES;
}
-(BOOL) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint point = [myTouch locationInView:[myTouch view]];
point = [[CCDirector sharedDirector] convertToGL:point];
CCNode *player = [self getChildByTag:kTagPlayer];
[player setPosition:point];
CCNode *computer = [self getChildByTag:kTagComputer];
[computer runAction:[CCMoveTo actionWithDuration:3.0
position:ccp(player.position.x, player.position.y)]
];
return YES;
}
As your warning states these methods are required to return nothing (
void), not a boolean value. Try to change it and see if it fixes the warning, otherwise the problem lies in your code and not in how these methods are called.