Xcode - 在项目中查找死方法 [英] Xcode -- finding dead methods in a project

查看:173
本文介绍了Xcode - 在项目中查找死方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇是否有任何工具为此提供部分解决方案。由于performSelector,这是一个棘手的问题。 。 。但是工具应该至少能够提出候选人,使人的工作变得更容易。

I am curious if there are any tools that provide partial solutions for this. It is a tricky problem because of performSelector . . . but a tool ought to at least be able to come up with candidates, making the human's job easier.

推荐答案

使用静态分析,由于Objective-C的动态特性,无法检测已定义但未使用的功能/方法。唯一合理的解决方案是使用 GCov 或类似工具。即使这样,你也必须让你的程序尽一切可能,以确保你不会删除一些在测试过程中没有使用过的功能。

Using static analysis, it is impossible to detect functions/methods that are defined but not used due to dynamic nature of Objective-C. The only reasonable solution is to run a coverage using GCov or similar tool. Even then, you will have to make your program do everything possible in order to make sure that you do not strip out some feature that was just not used during testing.

这个脚本对此有一些有趣的想法。

Also, this script has some interesting thoughts on this.

这篇关于Xcode - 在项目中查找死方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆