1. catch
@try { |
... |
} |
@catch (CustomException *ce) { // 1 |
... |
} |
@catch (NSException *ne) { // 2 |
// Perform processing necessary at this level. |
... |
} |
@catch (id ue) { |
... |
} |
@finally { // 3 |
// Perform processing necessary whether an exception occurred or not. |
... |
} |
2. throw
SException *exception = [NSException exceptionWithName: @"HotTeaException" |
reason: @"The tea is too hot" |
userInfo: nil]; |
@throw exception; |
沒有留言:
張貼留言