object-c 的错误构造,并抛出
object-c 的异常构造,并抛出
@try { NSException *exception = [NSException exceptionWithName: @"HotTeaException" reason: @"The tea is too hot" userInfo: nil]; @throw exception; } @catch (NSException *exception) { NSLog(@"main: Caught %@: %@", [exception name], [exception reason]); } @finally { NSLog(@"finally"); }