首页 > 解决方案 > Why unsigned xcarchive is larger than signed?

问题描述

I use the following command to generate signed xcarchive:

xcodebuild -workspace app.xcworkspace -scheme app -configuration 'Release' -sdk iphoneos archive -archivePath build/signed.xcarchive

to build unsigned xcarchive I just append at the end:

CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

And I'm curious why unsigned xcarchive has 332 MB and signed 222 MB?

I found out that for example libswiftCore.dylib in signed xcarchive has only 23.3 MB and in unsigned has 95.4 MB. Strange.

Difference

标签: iosswiftxcodexcodebuild

解决方案


在通过比较每个构建的输出进行进一步调查后,opendiff我发现每个构建的签名xcodebuild运行bitcode_strip都会dylib显着减小大小。

这就是为什么这两个版本之间存在大小差异的原因。

xcodebuild在未签名的构建运行的情况下更具体:

内置 swiftStdLibTool --copy --verbose ...

并且没有参数--sign它不会剥离位码。来自构建输出的消息:

忽略 --strip-bitcode 因为 --sign 没有通过

因此,这似乎是 的预期行为xcodebuild


推荐阅读