xcode iPhone 应用程序的条形符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/730478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:31:42  来源:igfitidea点击:

Strip symbols for iPhone application

iosobjective-cxcodesymbolsstrip

提问by user88645

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)生成调试符号(未选中)

回答by Nicholas Riley

Objective-C class and method information can't be stripped - it is necessary for execution. Best you can do is come up with some kind of obfuscation, if you want.

Objective-C 类和方法信息不能被剥离——这是执行所必需的。如果你愿意,你能做的最好的事情就是提出某种混淆。

回答by osexp2003

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)使用单独的条带(选中)

enter image description here

在此处输入图片说明

Of course, you need should check "Distribution" version in schema editor. enter image description here

当然,您需要在模式编辑器中检查“分发”版本。 在此处输入图片说明

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”命令:Show log navigator,选择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

enter image description here

在此处输入图片说明

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

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

00092ae4 t ___destroy_helper_block_200

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

000b0a00 t _pj_ioqueue_create

00092ae4 t ___destroy_helper_block_200

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.

注意:objective-C 方法和属性名称字符串仍然生成到应用程序文件,但这不是 OS 加载器的符号名称,它们只是objective-C 类的元数据。