使用 nm、strings 和/或 otool 来查找哪个库错误地使用了框架或方法 [英] Use nm, strings and/or otool to find which library is wrongly using frameworks or methods

查看:49
本文介绍了使用 nm、strings 和/或 otool 来查找哪个库错误地使用了框架或方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与此问题相同的问题.

I had the same problem as in this question.

该解决方案并未讨论如何使用 nmstringsotool 来搜索违规代码.

The solution doesn't discuss however how nm, strings or otool can be used to search for offending code.

假设违规代码使用了 AdSupport.framework 中的 ASIdentifierManageradvertisingIdentifier 方法.

Let say that the offending code uses ASIdentifierManager's advertisingIdentifier method from the AdSupport.framework.

  • 具体来说,如何用nmstringsotool来搜索二进制库?

即使 AdSupport.framework 不是链接二进制与库"构建阶段的一部分或通过 OTHER_LDFLAGS 链接,为什么没有链接器错误?

How come there is no linker error even though AdSupport.framework is not part of the "Link Binary With libraries" build phase or linked through OTHER_LDFLAGS?

在调试了许多项目后,我意识到检查是否(以及在何处)使用框架的最佳方法是尝试构建目标,而不在构建阶段或使用 OTHER_LDFLAGS 链接框架.

After debugging many projects I realized that the best way to check if (and where) a framework is used is simply trying to build the target without linking the framework neither in your Build Phases or using OTHER_LDFLAGS.

如果链接器失败,您将拥有负责使用它的类和库的名称.

If the linker fails you'll have the name of the class and library responsible for using it.

如果它通过,那么您可以向 Apple 解释该框架没有被使用,希望在他们的字符串搜索中显示.这有助于我们的申请被接受.

If it passes then you can explain to Apple that the framework is not being used desire showing up on their string searches. This worked for our applications to get accepted.

推荐答案

首先,你应该找到你的项目使用的 lib,比如 libxxx.a(libxxx.o).然后使用 nm/otool/strings,比如

First of all, you should find the lib your project use, like libxxx.a(libxxx.o). Then use nm/otool/strings,like


nm libxxx.a

可以添加额外的参数和grep供您参考.

Additional parameters and grep can be added for your reference.

这篇关于使用 nm、strings 和/或 otool 来查找哪个库错误地使用了框架或方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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