+(void) throwIfTrueWithParam: (Boolean) param {
@try {
if (param) {
@throw [NSException
exceptionWithName:@"TestException"
reason:@"test exception"
userInfo:nil];;
}
}
@catch (NSException *exception) {
NSLog(@"%@", @"catch");
}
@finally {
NSLog(@"%@", @"finally");
}
}
[self throwIfTrueWithParam:true];
//печатается: "catch" и "finally"
[self throwIfTrueWithParam:false];
//печатается только "finally"