无论内部最终块是什么(几乎)始终执行,那么将代码封装到其中或将其保持未封闭之间的区别是什么?
请考虑以下代码:
@try {
if (something.notvalid)
{
return;
}
// do something else
} @catch (NSException *ex) {
// handle exception
} @finally {
NSLog(@"finally!");
}
Run Code Online (Sandbox Code Playgroud)
如果something无效并且我从try中返回,代码是否@finally执行?我相信它应该,但我已经说过的其他人不这么认为,我现在无法测试这一点.