try & catch in iPhone?

Sam007 picture Sam007 · Apr 18, 2011 · Viewed 30.9k times · Source

The try{}catch construct is common to C++, Java & related languages. In the iOS SDK is there and any functionality like this?

Answer

Neil Knight picture Neil Knight · Apr 18, 2011
@try {
    // Try something
}
@catch (NSException * e) {
    NSLog(@"Exception: %@", e); 
}
@finally {
    // Added to show finally works as well
}