You get the compiler warning and the error because NSString * estado
is declared locally
in the if-block and locally in the else-block.
(Declaring a variable in a { ... }
block restricts the visibility to that block.) What you probably meant is
NSString * estado;
if ([TimeComparator dealWithTimeStrings2:locationObject.hor_LV]) {
estado = @"Open";
} else {
estado = @"Closed";
}
//... use estado ...