iOS - OC 异常处理
1、@try 语句 @try { // Code that can potentially throw an exception 可能会抛出异常的代码块 statement . . . } @catch (NSException *exception) { // Handle an exception thrown in the @try block 处理 @try 块抛出的异常 NSLog(@"%@, %@", [exception name], [exception reason]); statement . . . } @finally { // Code that gets executed whether or not an exception is thrown 无论是否抛出异常都要被执行的代码块 statement . . . } 当出现异常时,@catch 块被执行。包涵异常信息的 NSException 对象作为参数传递给这个块。name 监测异常的名称,reason 方法给出原因(运行时系统还是会将原因自动输出)。 在 @catch 块中的最后一条语句执行后,程序会...











