There is a H5 page in the project needs to be native, this page has a large number of local images, and these pictures are used 2x, 3x two sets of pictures, some of which are large enough to a single card can reach several m, the final result is the volume of the IPA package is extremely large. So try a lot of methods, finally the volume of the IPA has been reduced much. The next step is to summarize some of the ways you can slim your app.
1, from the picture resources to thin body.
(1) Compress the image itself . The designer compresses the picture when designing the big picture, then the client uses the compressed image, which can greatly reduce the volume of the IPA package. The big picture designers I used in the project did not compress it, so the designers helped to compress all the big pictures so that the pictures that were previously in M were compressed into K-units. Greatly reduces the volume of IPA.
(2) The client uses Assets.xcassets to manage the picture in the project, and avoids using the folder to manage the way. because of the assets.xcassets approach, all files in Images.xcassets are packaged as assets.car files when compiled, which can also reduce the app volume to some extent
(3) Clear the useless picture. in the version update, some of the previously used images may not be used in the new version, so those useless pictures should be remembered in time to clear.
(4) use vector images as much as possible. Some people say that this method does not play a big role in reducing the volume of IPA, but whether it is useful or not, I think it is a very worthy way to promote. Because a vector diagram can define its own size and color, for a single picture, you need only a set of graphs. For example, the icon in our project, can be solved with iconfont we will not go to use the transduction way. A Iconfont.ttf bag containing dozens of pictures is just more than 10 k size.
2. Organize the third-party library used in the project.
(1) third-party libraries that are not used in the project are also remembered to be deleted in time. (2) The introduction of third-party libraries to be cautious, learn to assess whether the introduction of this library is worthwhile. sometimes in order to introduce a large third library for a function, resulting in a significant increase in the volume of IPA, but maybe we only use a small part of the function, then you can consider the implementation of this function, rather than introduce the library.
(3) Delete useless picture resources in the three-party library. Some third-party libraries will have image resources and can be deleted directly for unused images.
3, the code level of optimization
(1) Unused code is cleaned up in time (2) collating duplicated code
4. Settings for compilation options(both set in Build settings)
For this piece, not special understand, so according to some of the methods available online, I tried, I feel that the following methods can certainly play a role, we can refer to. (1) Set the deployment postprocessing and strip Linked product options to Yes. (2) The Genetate Debug Symbols default to Yes, set to No. (3) Symbols hidden by default set to Yes(4) Strip debug Symbols during copy set to Yes
IOS IPA Package Optimization