标签:
之前没遇到过需要手动抛出异常的时候,这次见到了,记录一下。示例代码如下:
/** 如果调用 [[BNRItemStore alloc] init],就提示应该使用 [BNRItemStore sharedStore] */ - (instancetype)init { @throw [NSException exceptionWithName:@"Singleton" reason:@"Use + [BNRItemStore sharedStore]" userInfo:nil]; }
标签:
原文地址:http://www.cnblogs.com/jaxer/p/5398317.html