I want to handle freezing my program, when it load an xml from bad address.
I tryed it with using @try and @catch, but it doesn’t work.
Can I use some alternative handling?
@try{
NSString *test=[[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%@",addressLabel.text,portLabel.text]] encoding:NSUTF8StringEncoding error: nil];
}
@catch (NSException *ex) {
NSLog(@"Bad IP address");
return;
}
Run your XML Parser in
NSThreadand use notification for errors.