您的位置:首页 > 其它

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

2015-12-23 16:06 330 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  strip bitcode