I am defining the variable NSURL *url in a series of else if's where there cannot be an error so it will always be defined (I can add error catching later just in case).
This is a horrible way of doing this but im fairly new to the language.
if (whatTime == @"1000") {
NSURL *url = [NSURL URLWithString:@"http://yyy/json.php?f=1&time=1000"];
}else if(whatTime == @"1100"){
NSURL *url = [NSURL URLWithString:@"http://yyy/json.php?f=1"];
}else if(whatTime == @"1100"){
NSURL *url = [NSURL URLWithString:@"http://yyy/json.php?f=1"];
}
However the debugger is telling me url is undefined. Is there a way to get around this?
When I do (above the hell-pit of ifs) NSURL *url; it runs but says it is not connected to the internet.
==operators with calls to theisEqualToString:method calls. Example:if ([whatTime isEqualToString:@"1000"]).NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://yyy/json.php?f=1&time=", whatTime]];?%@format specifier is for Objective-C objects. Otherwise you use the same format specifiers as printf (such as %d and %f, etc.). See the docs forstringWithFormat:for full details.