在Xcode中查找未使用的文件 [英] Finding unused files in Xcode

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

问题描述

我最近开始研究一款新应用,它基本上是我之前制作的应用的副本,只有一些变化。为了制作这个新应用程序,我复制了旧应用程序并删除了一些不需要的东西。

I've recently started work on a new app which is basically a copy of a previous app I made, with a few changes. To make this new app I've copied the old app and removed some stuff that isn't needed.

我想知道,有什么方法可以判断Xcode中正在使用哪些类文件?或者有关如何查找未使用文件的任何提示?

I'm wondering, is there any way to tell which class files are being used in Xcode? Or any tips on how to find unused files?

推荐答案

Xcode中没有内置任何此类功能,但问题是未使用的类/文件等并不像人们想象的那么简单。

There isn't any functionality like this built into Xcode, but the issue of unused classes/files etc isn't as simple as one may think.

人们已经创建了脚本来尝试和确定未使用的文件。我使用了位于此处的脚本,它搜索了所有源文件,并尝试配置资源文件。该脚本还会尝试检查项目中未包含的源文件。

People have created scripts to try and determine unused files. I have used the script located here, which searches through all your source files, and tries to pair up the resource files. The script also tries to check for source files not included within your project.

它不是那么微不足道的原因是Obj-C是一种非常动态的语言;很多东西都是在运行时确定的。因此,静态找出未使用的文件有时会很棘手。例如,可能会根据用户输入动态确定图像名称。

The reason its not so trivial is that Obj-C is a very dynamic language; a lot of things are determined at run-time. As such, it sometimes can be tricky to figure out unused files statically. For example, an image name might be determined on the fly depending on user input.

我不知道您的应用程序有多大,但您可以尝试依赖图,并检查孤儿类。请参阅此博文了解更多信息。

I don't know how big your application is, but you could try a dependency graph, and check for orphan classes. See this blog post on some more information.

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

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