Use nm, strings and/or otool to find which library is wrongly using frameworks or methods

强颜欢笑 提交于 2019-12-06 06:24:52

问题


I had the same problem as in this question.

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

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

  • Concretely, how can binary libraries be searched with nm, strings or otool?

  • 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?

Edit:

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.

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.


回答1:


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

Additional parameters and grep can be added for your reference.




回答2:


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.

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.



来源:https://stackoverflow.com/questions/21545207/use-nm-strings-and-or-otool-to-find-which-library-is-wrongly-using-frameworks-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!