Analyze问题解决

936 阅读1分钟
最近公司的项目接近尾声了,用Analyze来检测一下,结果发现了些问题,自己顺便记录一下。

1、Value stored to '' during its initialization is never read这个值并没有被使用,注释或者删除即可;还有一种情况就是,初始化了两次

2、Passed-by-value struct argument contains uninitialized data (e.g., field: '')项目中的值没有及时的初始化,初始化使用后即可

3、The 'viewWillAppear:' instance method in UIViewController subclass '' is missing a [super viewWillAppear:] call


没有调用super方法

4、Returning 'self' while it is not set to the result of '[(super or self) init...]'


修改成如下

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self layoutUI];
    }
    return self;
}