本文介绍了在Objective-C中返回后,代码终于得到运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下代码:

@try {
  if (something.notvalid)
  {
    return;
  }
  // do something else
} @catch (NSException *ex) {
  // handle exception
} @finally {
  NSLog(@"finally!");
}

如果某事无效,我从试用中返回,代码是否执行 @finally ?我相信这应该是别人所说的,不要这么认为,我目前无法测试。

If something is not valid and I return from within the try, does the code in @finally execute or not? I believe that it should but others I've spoken to don't think so and I'm unable to test this at the moment.

推荐答案

@finally代码总是根据和。

@finally code always executes according to here and here.

这篇关于在Objective-C中返回后,代码终于得到运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 01:54