Ahan Malhotra
Ahan Malhotra

Reputation: 185

Various Odd Errors in Xcode

In Xcode, I am getting some various odd errors that should build normally.

First, In

- (void)touchesMoved:(NSSet *)touches withEvent(UIEvent *)event {
    [self touchesBegan:touches withEvent:event];
    marblebeingdragged = NO;
}

it gives me the errors:

error: Semantic Issue: Use of undeclared identifier 'touchesMoved'
in the first line: `expected ';' before ':' token`

Also, in my switch statement: (Note the errors that are commented in the case and break statements)

switch (marblecolor) {    
    case 1: //Aqua
        plusone.image = [UIImage imageNamed: @"Aqua/+1"]; //Parse Issue: Extraneous ']' before ';'

        plustwo.image = [UIImage imageNamed: @"Aqua/+2"];
        plusthree.image = [UIImage imageNamed: @"Aqua/+3"];
        minusone.image = [UIImage imageNamed: @"Aqua/-1"];
        minustwo.image = [UIImage imageNamed: @"Aqua/-2"];
        minusthree.image = [UIImage imageNamed: @"Aqua/-3"];
            break; //Semantic Issue: 'break' statement not in loop or switch statement

    case 2: //Blue //Semantic Issue: 'case' statement not in switch statement
        plusone.image = [UIImage imageNamed: @"Blue/+1"];
        plustwo.image = [UIImage imageNamed: @"Blue/+2"];
        plusthree.image = [UIImage imageNamed: @"Blue/+3"];
        minusone.image = [UIImage imageNamed: @"Blue/-1"];
        minustwo.image = [UIImage imageNamed: @"Blue/-2"];
        minusthree.image = [UIImage imageNamed: @"Blue/-3"];
        break; //Semantic Issue: 'break' statement not in loop or switch statement

    case 3: //Green //Semantic Issue: 'case' statement not in switch statement
        plusone.image = [UIImage imageNamed: @"Green/+1"];
        plustwo.image = [UIImage imageNamed: @"Green/+2"];
        plusthree.image = [UIImage imageNamed: @"Green/+3"];
        minusone.image = [UIImage imageNamed: @"Green/-1"];
        minustwo.image = [UIImage imageNamed: @"Green/-2"];
        minusthree.image = [UIImage imageNamed: @"Green/-3"];
            break; //Semantic Issue: 'break' statement not in loop or switch statement

    case 4: //Semantic Issue: 'case' statement not in switch statement
        plusone.image = [UIImage imageNamed: @"Grey/+1"];
        plustwo.image = [UIImage imageNamed: @"Grey/+2"];
        plusthree.image = [UIImage imageNamed: @"Grey/+3"];
        minusone.image = [UIImage imageNamed: @"Grey/-1"];
        minustwo.image = [UIImage imageNamed: @"Grey/-2"];
        minusthree.image = [UIImage imageNamed: @"Grey/-3"];
            break; //Semantic Issue: 'break' statement not in loop or switch statement

    case 5: //Pink //Semantic Issue: 'case' statement not in switch statement
        plusone.image = [UIImage imageNamed: @"Pink/+1"];
        plustwo.image = [UIImage imageNamed: @"Pink/+2"];
        plusthree.image = [UIImage imageNamed: @"Pink/+3"];
        minusone.image = [UIImage imageNamed: @"Pink/-1"];
        minustwo.image = [UIImage imageNamed: @"Pink/-2"];
        minusthree.image = [UIImage imageNamed: @"Pink/-3"];
            break;
}

Lastly, in my @end it gives the error: expected declaration or statement at end of input.

Any clues to the errors?

Upvotes: 0

Views: 902

Answers (1)

Cajunluke
Cajunluke

Reputation: 3113

For starters, your - (void)touchesMoved:(NSSet *)touches withEvent(UIEvent *)event { line needs a colon after withEvent, so it should be - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {.

Fix that and we'll see what works. (EDIT: Looking at your other errors, they may go away after you've fixed the method declaration typo. I would certainly expect the @end error to go away.)

Upvotes: 4

Related Questions