@try - catch block in Objective-C

asked15 years ago
last updated6 years ago
viewed160.3k times
Up Vote199Down Vote

Why doesn't @try block work? It crashed the app, but it was supposed to be caught by the @try block.

NSString* test = [NSString stringWithString:@"ss"];

 @try {
    [test characterAtIndex:6];

 }
 @catch (NSException * e) {
    NSLog(@"Exception: %@", e);
 }
 @finally {
    NSLog(@"finally");
 }