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 case you need to open a new scope. To open a new scope simply use curly braces as others have already written.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With