Object-C 2.0 异常处理
Object-C 2.0 异常处理
源代码:
#import "Fraction.h"int main(int argc, char *argv[]){NSAutoleasePool *pool = [[NSAutoreleasePool alloc] init];Fractoin *f = [[Fraction alloc] init];@try{[f noSuchMethod];}@catch(NSException *exc){NSLog(@"Caught %@%@", [exc name], [exc reason]);}NSLog(@"Exception continues!");[f release];[pool drain];return 0;}