I have the function below that validates the return of another function (function searchPlaces that returns NSString). When I run it, it seems that the if clause is not being called, because the NSLog(@"Function Return: %@",nova url); appears in Console.
Can someone tell me if there's any mistake in the code? (For sure there is a mistake!)
- (void) buttonPushRandomViewController1 {
UIViewController *randomViewController = [self randomViewController3];
NSString *novaurl = [self searchPlaces];
NSLog(@"Function Return: %@",novaurl);
if (novaurl == @"OK") {
randomViewController.title = @"Resultado";
[self.master pushViewController:randomViewController animated:YES];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:novaurl]];
[webView loadRequest:request];
}else if (novaurl == @"ZERO_RESULTS") {
UIAlertView *zeroResults = [[UIAlertView alloc] initWithTitle: @"Ops!" message: @"Sorry, nothing found!"
delegate: self cancelButtonTitle: @"OK" otherButtonTitles: nil];
[zeroResults show];
[zeroResults release];
}
}
Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…