美文网首页
Analyze静态分析

Analyze静态分析

作者: 关羽007 | 来源:发表于2019-02-26 15:52 被阅读0次

错误类型

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了

相关文章

网友评论

      本文标题:Analyze静态分析

      本文链接:https://www.haomeiwen.com/subject/sowayqtx.html