【发布时间】:2011-10-16 20:16:27
【问题描述】:
我有下面的函数来验证另一个函数的返回(返回 NSString 的函数 searchPlaces)。当我运行它时,似乎没有调用 if 子句,因为 NSLog(@"Function Return: %@",nova url);出现在控制台中。
谁能告诉我代码中是否有任何错误? (肯定有错误!)
- (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];
}
}
提前致谢!
【问题讨论】:
标签: objective-c ios