执行文件如下:
@implementation Utils
+(id)alloc
{
return [self instance];
}
+(Utils *)instance
{
static Utils *utils = nil;
if (!utils) {
utils = [self init];
}
return utils;
}
-(Utils *)init
{
self = [super init];
if (self) {
mConst = [Constants instance];
mCONT_REGEXP = [mConst CONT_REGEXP];
}
return self;
}
在调用[Utils instance];
时报错:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[Utils<0xbff54> init]: cannot init a class object.'