简体   繁体   English

剥离iPhone应用程序的符号

[英]Strip symbols for iPhone application

What are the settings in Xcode to strip symbols for an iphone application? Xcode中有哪些设置可以剥离iphone应用程序的符号?

I use these settings in Xcode but still see classnames and their methods in the executable using a binary file editor. 我在Xcode中使用这些设置,但仍然使用二进制文件编辑器在可执行文件中看到类名和它们的方法。

Deployment: 部署:

1) Deployment Post processing(checked) 1)部署后处理(已检查)

2) Strip Debug Symbols During Copy(checked) 2)复制期间剥离调试符号(选中)

3) Strip Linked Product(checked) 3)剥离链接产品(已选中)

4) Use Separate Strip(checked) 4)使用单独的带(已选中)

Linking: 链接:

5) Dead Code Stripping(checked) 5)死代码剥离(已检查)

GCC 4.0 - Code Generation GCC 4.0 - 代码生成

6) Generate Debug Symbols(NOT checked) 6)生成调试符号(未选中)

Objective-C class and method information can't be stripped - it is necessary for execution. Objective-C类和方法信息不能被剥离 - 它是执行所必需的。 Best you can do is come up with some kind of obfuscation, if you want. 如果你愿意,你能做的最好就是想出某种混淆。

I did it. 我做的。

I only checked following three settings, other setting is irrelevant. 我只检查了三个设置,其他设置无关紧要。

1) Deployment Postprocessing (checked) 1)部署后处理(已检查)

3) Strip Linked Product (checked) 3)剥离链接产品(已选中)

4) Use Separate Strip (checked) 4)使用单独的带(已选中)

在此输入图像描述

Of course, you need should check "Distribution" version in schema editor. 当然,您需要在架构编辑器中检查“分发”版本。 在此输入图像描述

Then clean!!! 然后清洁!!! and build. 并建立。

I'v also confirmed that "strip" command is called by Xcode: Show log navigator, select Build .... release, at the bottom, i found progress description: 我还确认Xcode调用“strip”命令:显示日志导航器,选择Build .... release,在底部,我找到进度描述:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip /Users/xxx/Library/Developer/Xcode/DerivedData/aaaaa-dytaamkvztdwfreoqteyeijwqdcu/Build/Products/Distribution-iphoneos/aaaaa.app/aaaaa

在此输入图像描述

Finally, I'v checked the result by "nm" command to final product file, 最后,我通过“nm”命令检查结果到最终产品文件,

nm -a /Users/xxx/Library/Developer/Xcode/DerivedData/aaaaa-dytaamkvztdwfreoqteyeijwqdcu/Build/Products/Distribution-iphoneos/aaaaa.app/aaaaa

All function name of current app is really stripped. 当前应用的所有功能名称都被剥离了。 Such as following function name : 如下面的函数名称:

000b0a00 t _pj_ioqueue_create 000b0a00 t _pj_ioqueue_create

00092ae4 t ___destroy_helper_block_200 00092ae4 t ___destroy_helper_block_200

00092af8 t ___68-[MyClass myMethod:param2]_block_invoke_21782 00092af8 t ___ 68- [MyClass myMethod:param2] _block_invoke_21782

Note: objective-C method and property name string are still produced to app file, but that is not symbol name for OS loader, they are just meta data of objective-C class. 注意:仍然会为app文件生成objective-C方法和属性名称字符串,但这不是OS加载程序的符号名称,它们只是objective-C类的元数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM