升级到xcode7之后ipa文件尺寸增大,strip无效问题

If you have recently updated to new Xcode, you must have noticed the significant change in binary size. I saw it first when I was updating the  JXcore 's iOS binaries. (If you didn't hear before, JXcore runs node.js applications on Android and iOS.) Long story short, the new binary was almost 10 times bigger than the previous one. 

Some of the problems you might be facing with;

- `strip` command is no longer reducing the binary size
- compiled binary is no longer Xcode 6.x compatible (especially the simulators)
- Whatever you did, the binary size is more than 2 times bigger than previous one

Following list of compiler tweaks helped me to solve the problems above. The final binary size was still 1.4x bigger though but this much is really reasonable comparing to my first result.

ENABLE_BITCODE - '-fembed-bitcode'
Starting with the Xcode 7, '-fembed-bitcode' is default during compilation. If you want to keep your framework compatible with Xcode 6.x version, do not use this setting when compiling simulator builds! It will be still working for Xcode 7 hence for the simulators yet it will be also compatible with Xcode 6 builds.

GCC_GENERATE_DEBUGGING_SYMBOLS - '-fno-standalone-debug'
Use (both) settings above for compilation step. These settings kick in before the LLVM bitcode is embedded. So, the binary won't be carrying the LLVM IR for debugging. Now you know the reason why 'strip' didn't help.

P.S. both `-fembed-bitcode` and `-fno-standalone-debug` are compile time options

Optimizing the binary size while preserving the compatibility took my last three hours. Hope the information above saves yours.

P.S. you still need `strip` if you were already using it
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值