if comment the nslog-line, there is an error:
Semantic Issue: Use of undeclared
identifier ‘alert’
switch ([[array objectAtIndex:0]intValue]) {
case 2:
NSLog(@"Allergie alarm"); << commenting this, gives me an error!!!
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"blabal"
message: @"balbalb"
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
[alert release];
break;
default:
break;
}
In order to declare a new variable inside a
caseyou need to open a new scope. To open a new scope simply use curly braces as others have already written.