You better reconstruct it like:
if ([startLocationAddress rangeOfString:@"Australia"].location == NSNotFound)
{
//codes..
}
else
{
NSLog(@"startLocationAddress contain Australia");
}
if ([endLocationAddress rangeOfString:@"Australia"].location == NSNotFound)
{
//codes..
}
else
{
NSLog(@"endLocationAddress contain Australia");
}
and review how if–else if–else statement works.. See: @
Hanky 웃 Panky answer for that, since confusion is very prone to us..
if (ifcondition)
{ .. }
else if (elseifcondition)
{ .. }
else
{ .. }
/*
if `ifcondition` == true, dont expect anything from `else-if` or `else`,
compiler won't care about them anymore. that goes with `else-if` and `else` as well..
*/
1
solved else if condition concept