I am trying to implement this button action, but the if statement is not evaluating to be true. I have a situation where the value in that "School" dictionary will not always have a website stored. For that reason i want to check, but what do i check against. If "nil" is not stored there when there is not a value, then what is?
-(IBAction) btnVisitWebsite_clicked :(id)sender {
if([School objectForKey:WEBSITE_KEY] == nil){
UIAlertView *NoWebsite = [[UIAlertView alloc]initWithTitle: @"No Website"
message:@"The selected school has not listed a website"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
NoWebsite.tag = 15;
[NoWebsite show];
[NoWebsite release];
NoWebsite = nil;
}
else{
NSMutableString *WebsiteVisit = [[NSMutableString alloc] initWithString: @"http://"];
[WebsiteVisit appendString:[School objectForKey:WEBSITE_KEY]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: WebsiteVisit]];
[WebsiteVisit release];
}
}