iOS ipa optimization package, reducing the size of the installation package

https://www.jianshu.com/p/a49d59b01669

 

After the project packaged .ipa package size is 118.9M, after upload to the App Store on display 85.5M iPhone6s, download time is too long, so look for some optimization methods, the following are written by someone else own tried it really easy to use, not original, just record it.


1. Configuring the Compile Options 

(Within Levels option) Generate Debug Symbols set to NO, this configuration option should let you subtract less than half the volume. If set to NO Note that this will not stop at the breakpoint

 
 

2, give up architecture armv7

armv7 to support 4s 4,4s and is formally launched in November 2011, although there is a small percentage of people use, but the pursuit of inclusion size can be completely abandoned.

 
 

3, removal of unwanted tripartite library code, readme

4, image processing

Pictures of the installation package footprint is the biggest thing, my project takes up half of the volume.

    * Use imageoptim compressed image size

    * Some of the more bulky compressed into a background image in .jpg format.

    * Find a LSUnusedResource this software projects did not use the picture, and then delete, of course, is not necessarily particularly accurate, there are some [UIImage imageNamed: [NSString stringWithFormat: @ "icon_% d", index]] this picture will be used unused columns in the picture.

   * Use Assets.xcassets manage pictures can be reduced to the volume of the installation package

5, build setting in DEAD_CODE_STRIPPING = YES (default is as if YES). Determining dead code (codes are defined but not called) is stripped to remove redundant code, even if a bit redundant code, compiled volume is very significant.

 
 

6, compiler optimization level

Build Settings-> Optimization Level has several compiler optimization options, release version should choose Fastest, Smalllest [-Os], this option will turn on all those who do not optimized to increase the size of the code, and let the executable file as small as possible.

 
 

7, the symbol information is removed

Strip Debug Symbols During Copy and Symbols Hidden by Default in the release version should be set to yes, you can remove unneeded debugging symbols. Symbols Hidden by Default will all the symbols are defined as "private extern", set up after the volume decreases.

 
 
 
 
 

8, Strip Linked Product: DEBUG under is NO, RELEASE under YES, the app for size reduction of the RELEASE mode;

 
 

2018.7.17 New

9, compiler optimization, remove the abnormal support. Enable C ++ Exceptions, Enable Objective-C Exceptions to NO, Other C Flags added -fno-exceptions

 
 

 
 

Enable C++ Exceptions
 
Enable Objective-C Exceptions
 
Other C Flags添加-fno-exceptions

10, using AppCode  code detecting unused: menu bar -> Code-> InspectCode

Finally: Set in xcode BulidSetting can distinguish between debug and release, if that would like to use these during development, debug and release is provided separately put on it



Author: Missmiss ignorant
link: https: //www.jianshu.com/p/a49d59b01669
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

 

Guess you like

Origin www.cnblogs.com/sundaysgarden/p/11927728.html
Recommended