Find size contributed by each external library on iOS

前端 未结 4 1550
滥情空心
滥情空心 2020-12-08 22:02

I\'m trying to reduce my app store binary size and we have lots of external libs that might be contributing to the size of the final ipa. Is there any way to find out how mu

4条回答
  •  天命终不由人
    2020-12-08 22:08

    Also make sure that you set Generate Debug Symbols to NO in your build settings. This can reduce the size of your static library by about 30%.

    In case it's part of your concern, a static library is just the relevant .o files archived together plus some bookkeeping. So a 1.7mb static library — even if the code within it is the entire 1.7mb — won't usually add 1.7mb to your product. The usual rules about dead code stripping will apply.

    Beyond that you can reduce the built size of your code. The following probably isn't a comprehensive list.

    In your target's build settings look for 'Optimization Level'. By switching that to 'Fastest, Smallest -Os' you'll permit the compiler to sacrifice some speed for size.

    Make sure you're building for thumb, the more compact ARM code. Assuming you're using LLVM that means making sure you don't have -mno-thumb anywhere in your project settings.

    Also consider which architectures you want to build for. Apple doesn't allow submission of an app that supports both ARMv6 and the iPhone 5 screen and have dropped ARMv6 support entirely from the latest Xcode. So there's probably no point including that at this point.

提交回复
热议问题