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
}
posted @ 2013-05-17 17:26  潁川君  阅读(3084)  评论(0编辑  收藏  举报