切换到Xcode 7后,应用程序大小从9 MB增加到60 MB,有没有修复? [英] After switching to Xcode 7, app size grew from 9 MB to 60 MB, is there a fix?
问题描述
我在Git历史上一直在寻找文件大小变化的原因,但我能找到的唯一真正原因是从Xcode 6切换到Xcode 7 GM。
I've been going backwards in Git history to find the cause of a humongous file size change, but the only real reason I can find is the switch from Xcode 6 to Xcode 7 GM.
我发现这些是从 Archive 操作创建的 .ipa
中的前10个文件大小贡献者发布构建配置:
I've found that these are the top 10 file size contributors in an .ipa
created from the Archive operation on a Release build configuration:
$ unzip -lv Roger\ Release.ipa | sort -k +3nr | head
41802768 Defl:N 16887199 60% 09-14-15 23:47 dc24cdc1 Payload/Roger.app/Frameworks/libswiftCore.dylib
41802400 Defl:N 16886076 60% 09-06-15 18:33 f939ea6a SwiftSupport/iphoneos/libswiftCore.dylib
11184032 Defl:N 5915625 47% 09-14-15 23:48 6ceac4a2 Payload/Roger.app/Roger
6399584 Defl:N 2670275 58% 09-14-15 23:47 0ac52d3f Payload/Roger.app/Frameworks/libPhoneNumber_iOS.framework/libPhoneNumber_iOS
5410384 Defl:N 2334189 57% 09-14-15 23:47 7a8cb03f Payload/Roger.app/Frameworks/Alamofire.framework/Alamofire
4521904 Defl:N 2292789 49% 09-14-15 23:47 95da0882 Payload/Roger.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit
4731552 Defl:N 1926357 59% 09-14-15 23:48 e05337de Payload/Roger.app/Frameworks/libswiftFoundation.dylib
4731168 Defl:N 1925355 59% 09-06-15 18:33 19a5c3c4 SwiftSupport/iphoneos/libswiftFoundation.dylib
2659232 Defl:N 1232897 54% 09-14-15 23:47 1a53a401 Payload/Roger.app/Frameworks/AFNetworking.framework/AFNetworking
1196624 Defl:N 545343 54% 09-14-15 23:47 19a063cb Payload/Roger.app/Frameworks/Bolts.framework/Bolts
到目前为止,最大的文件是两个(略有不同) libswiftCore.dylib
文件,总计超过32 MB。在由Xcode 6构建的捆绑包中,这两个文件总共只有3 MB。
By far the largest files are the two (slightly different) libswiftCore.dylib
files, which total over 32 MB. In the bundle built by Xcode 6 these two files totaled only 3 MB.
所以问题#1是:为什么Swift核心文件有两次? (嵌入式内容包含Swift代码设置为否)。
So question #1 is: Why are the Swift core files there twice? (Embedded Content Contains Swift Code is set to No).
问题#2是:发生了什么?为什么Swift核心大小增加15 MB?这是永久性的吗?
And question #2 is: What happened? Why did the Swift core size increase by 15 MB? Is this permanent?
一些额外的注释:
- 这是一个项目完全是Objective-C但现在主要是Swift。 定义模块设置设置为是。
- 项目使用CocoaPods与
use_frameworks!
set。 - 我已经在多个设备和iOS版本上确认了TestFlight的实际下载大小,它的范围是30-60 MB(可能是应用程序造成的差异)切片)。它曾经是9 MB。
- This is a project that was entirely Objective-C but is now mostly Swift. The Defines Module setting is set to Yes.
- The project uses CocoaPods with
use_frameworks!
set. - I've confirmed the actual download size from TestFlight on multiple devices and iOS versions and it's in the range 30–60 MB (presumably the difference is due to app slicing). It used to be 9 MB.
推荐答案
很可能是由BitCode引起的,我见过同样的增长但是一旦从App Store部署,应用程序大小实际上并没有增长。
Most likely caused by BitCode, I have seen the same growth however once deployed from the App Store the app size hasn't actually grown.
您可以在应用程序和其他目标中禁用BitCode,您应该看到收缩。
You can disable BitCode in your app and the other targets as well and you should see a shrinkage.
这篇关于切换到Xcode 7后,应用程序大小从9 MB增加到60 MB,有没有修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!