Analyze静态分析

2019-02-26  本文已影响0人  关羽007

错误类型

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

没有初始化

 解决方法

     self = [super init];

           if(self) {

           }

    return self;

2 Potential leak of an object stored into 'xx'

需要释放内存

解决方法 需要查看没有释放的'xx'是什么类型的变量

CGColorSpaceRef - > CGColorSpaceRelease(xx);

CGContextRef -> CGContextRelease(xx)

CGImageRef -> CGImageRelease(xx);

3 Dead store 

无效数据: 意思就是声明的变量或者对象初始化没有使用 

一般建议注释掉

4 Incorrect decrement of the reference count of an object that is not owned at this point by the caller

多次释放,只需要释放一次内存就可以了

5 Instance variable 'xxxxx' in class 'className' is never used by the methods in its @implementation (although it may be used by category methods)

本地变量跟函数参数变量同名

我是没有用上 注释就OK了

上一篇 下一篇

猜你喜欢

热点阅读