analyze instance variable used while 'self' is not set to the result of '[(super or self) init...]


在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
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM