try & catch in iPhone?

2019-01-22 06:55发布

问题:

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

回答1:

@try {
    // Try something
}
@catch (NSException * e) {
    NSLog(@"Exception: %@", e); 
}
@finally {
    // Added to show finally works as well
}