在xcode中写init函数时一般都是如下写法:
-(id) init
{
if(![super init])
{
return nil;
}
//todo
return self
}
但是analyze分析器会提示instance variable used while 'self' is not set to the result of '[(super or self) init...]
只要做如下修改就没有问题了。
-(id) init
{
self = [super init];
if(!self)
{
return nil;
}
//todo
return self
}
-(id) init
{
if(![super init])
{
return nil;
}
//todo
return self
}
但是analyze分析器会提示instance variable used while 'self' is not set to the result of '[(super or self) init...]
只要做如下修改就没有问题了。
-(id) init
{
self = [super init];
if(!self)
{
return nil;
}
//todo
return self
}