xcode之静态扫描( Xcode static analyzer)

来源:互联网 发布:金十数据手机官网 编辑:程序博客网 时间:2024/06/15 22:57

Static Analysis 是基于Clang 的非常好的静态代码分析工具。

主要从以下几个方面进行检测:

  • Logic flaws, such as accessing uninitialized variables and dereferencing null pointers(逻辑错误,比如访问未初始化的变量、解引用空指针)

  • Memory management flaws, such as leaking allocated memory(内存管理错误,比如内存泄露,在MRC机制下很有用)
  • Dead store (unused variable) flaws(死存储,比如未使用的变量)
  • API-usage flaws that result from not following the policies required by the frameworks and libraries the project is using(API使用错误)
使用方法:

1、点击product -> Analyze(shift+command+B)



2、选择某一条分析消息



3、点击相应的消息



4、点击箭头,查看错误跟踪线



5、编辑代码修改错误


0 0
原创粉丝点击