读书人

object-c 的错误构造并抛出

发布时间: 2012-06-27 14:20:09 作者: rapoo

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");    }
?

读书人网 >移动开发

热点推荐