iDevGames Forums
Weird Compiler WARNING... help? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Weird Compiler WARNING... help? (/thread-874.html)



Weird Compiler WARNING... help? - Elphaba - Aug 10, 2009 10:42 PM

Hi.

IF I have the following code, everything compiles fine - no errors, no warnings.

Code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event withView:(UIResponder *)receivingView
{
    for (UITouch * touch in touches)
    {    
        CGPoint point = [touch locationInView:receivingView];
        _numberOfActiveTouches++;
        NSLog(@"Active Touches = %i, Touch at : %f",_numberOfActiveTouches, point);
    }
}


However, if I add this one line below the NSLog line...
Code:
        [self touchDownDetected:point];


So the method looks like this

Code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event withView:(UIResponder *)receivingView
{
    for (UITouch * touch in touches)
    {    
        CGPoint point = [touch locationInView:receivingView];
        _numberOfActiveTouches++;
        NSLog(@"Active Touches = %i, Touch at : %f",_numberOfActiveTouches, point);
        [self touchDownDetected:point];
    }
}

then I get the following compiler WARNING...

warning: passing argument 1 of 'locationInView:' from distinct Objective -C type



I can't work out why... what am I missing?


The method that's being called is this:

Code:
- (void) touchDownDetected:(CGPoint) point
{
    // Blah blah blah
}



Weird Compiler WARNING... help? - Elphaba - Aug 10, 2009 10:51 PM

Fixed it... Grrrr...

replaced the (UIResponder *) with (UIView *)

and it's all good.

Sorry.