删除 Xcode 中未使用的框架? [英] Removing unused frameworks in Xcode?

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

问题描述

随着时间的推移,当您开发应用程序时,您会向其中添加新库,这些库需要新的框架才能正常工作.然后删除库,如果您像我一样忘记删除最初添加的框架.

Over time when you develop an application you add new libraries to it, new frameworks needed for the libraries to work. Then you remove libraries and if you are like me you have forgotten to remove the frameworks that you initially added.

有没有办法找出我的代码需要哪些框架才能运行?

Is there a way to find out what frameworks are needed for my code to function?

推荐答案

我只是从 Xcode 中的链接阶段(或 xcconfig,如果你在那里定义它们)中删除有问题的框架,然后根据 ld 的错误重新引入框架.

I just delete the questionable frameworks from the link phase in Xcode (or the xcconfig, if you define them there) and reintroduce the frameworks based on ld's errors.

如果您的目标是多个操作系统版本,那么构建和链接这些 SDK 可能是个好主意,因为事情可能会发生一些变化.

If you are targeting multiple OS versions, it may be a good idea to also build and link against those SDKs since things can move around a bit.

我通常也不会将静态库链接到它们的依赖项,而是将其保留给最终的可执行文件.

I also do not typically link static libraries to their dependencies, reserving that for the final executable.

该阶段完成后,您可以从 Xcode 项目中删除未链接的框架.

Once that phase is complete, you can remove the frameworks you do not link from your Xcode project.

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

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