gpt4 book ai didi

ios - 为什么 CocoasPod 会增加 IPA 大小?如何减小尺寸?

转载 作者:行者123 更新时间:2023-12-02 01:55:35 25 4
gpt4 key购买 nike

CocoasPod 很好,但有时又不好。
为什么?因为您的项目中有一个名为“-ObjC”的标志。
它将把所有对象文件拉入生成的二进制文件中。

例如,一个带有“pod 'AFNetworking'”且标志“-ObjC”打开的空项目,这将导致二进制文件为 7MB。一个空项目需要 7MB,太糟糕了。

某些框架(例如 Google Map SDK)需要启用“-ObjC”标志。
因此,如果您的项目包含“AFNetworking pod”和“Google Map SDK”,则会导致二进制文件为 17MB。

所以我的问题是:
如何关闭特殊库的“-ObjC”标志?
例如,只需保留 Google Map SDK 的“-ObjC”,但在 AFNetworking 上将其关闭。

最佳答案

您应该尝试回答 this question从而减小.ipa的大小。

In general, adding a static library to your project in Objective-C will pull ALL OBJECT FILES into your resulting binary because cocoa pods installation adds -ObjC flag to your linker settings, and as stated in linker manual:

-ObjC        Loads all members of static archive libraries that implement
an Objective-C class or category.

This flag included to solve problem with linking categories, because by default linker will not include object files containing only categories into resulting binary.

关于ios - 为什么 CocoasPod 会增加 IPA 大小?如何减小尺寸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24325899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com