问题描述
我在其中一个项目中使用Swift,最后是时候将它上传到应用程序商店了。应用程序大小是一个问题,因为下载更大尺寸的应用程序不是用户的选择。该应用程序的应用商店大小为40MB。它是好的,直到Android版本上传,它是6MB。我在iOS应用程序中使用了app thinning,它仍然非常大。我检查了ipa的(89MB)内容,发现ipa文件中包含了很快的库。我在互联网上搜索:
编辑:2017年11月22日
今天我检查了同一个应用程序的iTunes连接,发现新的下载大小标签,它显示与上次实验相比,下载量减少。
旧答案
我创建了两个包含iPhone核心数据的单一视图应用程序。一个在 Swift ,另一个在 Objective-C 。两者都有默认的项目模板,并没有写任何额外的代码。我在两个项目中都添加了相同的应用程序图标。
然后从两个项目创建ipa并在iTunesconnect上作为版本1和2上传
然后我使用命令解压缩了两个ipa文件 - 解压缩 - lv
并发现在 Swift 版本的ipa中有三个额外的文件夹
- 框架(67.09MB)
- SwiftSupport(66.56MB)
- 符号(15.42MB)
当我仅压缩这三个文件夹(Frameworks + SwiftSupport + Symbols)时,压缩大小为59.5 MB。而ipa的总大小为59.6MB。很明显, Swift 库正在增加应用的大小。
unzip -lv SizeSwiftTest.ipa
长度方法大小Cmpr日期时间CRC-32名称
-------- ------ --- ---- ---- ---------- ----- -------- ----
46125024 Defl:N 18988843 59%01-28- 2017 10:02 14b9d63c Payload / SizeSwiftTest.app / Frameworks / libswiftCore.dylib
743568 Defl:N 216552 71%01-28-2017 10:02 79b72c24 Payload / SizeSwiftTest.app / Frameworks / libswiftCoreData.dylib
1137184 Defl:N 383891 66%01-28-2017 10:03 86bd6df6 Payload / SizeSwiftTest.app / Frameworks / libswiftCoreGraphics.dylib
257616 Defl:N 24550 91%01-28-2017 10:03 a6da0939 Payload / SizeSwiftTest.app/Frameworks/libswiftCoreImage.dylib
543696 Defl:N 176102 68%01-28-2017 10:03 94937782 Payload / SizeSwiftTest.app / Frameworks / libswiftDarwin.dylib
2562272 Defl:N 954097 63 %01-28-2017 10:04 55a778fc Payload / SizeSwiftTest.app / F. rameworks / libswiftDispatch.dylib
17463360 Defl:N 7412237 58%01-28-2017 10:04 6f6526c0 Payload / SizeSwiftTest.app / Frameworks / libswiftFoundation.dylib
506192 Defl:N 165186 67%01-28 -2017 10:04 ad88cf40 Payload / SizeSwiftTest.app / Frameworks / libswiftObjectiveC.dylib
311520 Defl:N 60300 81%01-28-2017 10:05 85363d5d Payload / SizeSwiftTest.app / Frameworks / libswiftQuartzCore.dylib
699712 Defl:N 273308 61%01-28-2017 10:05 c7d7022a Payload / SizeSwiftTest.app / Frameworks / libswiftUIKit.dylib
45775648 Defl:N 18627456 59%12-07-2016 05:23 81fe5af9 SwiftSupport / iphoneos / libswiftCore.dylib
741104 Defl:N 209836 72%12-07-2016 05:23 4acecaad SwiftSupport / iphoneos / libswiftCoreData.dylib
1133696 Defl:N 374501 67%12-07-2016 05:23 8b024942 SwiftSupport / iphoneos / libswiftCoreGraphics.dylib
256368 Defl:N 22243 91%12-07-2016 05:23 325cc5a7 SwiftSupport / iphoneos / libswiftCoreImage.dylib
541792 Defl:N 170804 69%12-07-2016 05:23 f41ed047 SwiftSupport / iphoneos / libswiftDarwin.dylib
2522368 Defl:N 932905 63%12-07-2016 05:22 09cecc4f SwiftSupport / iphoneos / libswiftDispatch.dylib
17318784 Defl:N 7278280 58%12-07-2016 05:22 4af20463 SwiftSupport / iphoneos / libswiftFoundation.dylib
504304 Defl:N 160214 68%12-07-2016 05:22 1093b583 SwiftSupport / iphoneos / libswiftObjectiveC.dylib
310112 Defl:N 57522 82%12-07-2016 05:23 a613dad2 SwiftSupport / iphoneos / libswiftQuartzCore.dylib
697344 Defl:N 266430 62%12-07-2016 05:23 d6bf939b SwiftSupport / iphoneos /libswiftUIKit.dylib
22576 Defl:N 6387 72%01-28-2017 10:01 b3c45d81符号/ 1BFFD5D6-0677-33B3-BAEC-046295DEA090.symbols
29064 Defl:N 8112 72%01-28-2017 10:01 d6c556b3符号/ 2582C775-1993-3EB6-8824-D3F9A75ADE6D.symbols
3613720 Defl:N 559651 85%01-28-2017 10: 01 34544697符号/ 26F02EDA-79FE-32B9-BD99-BD076B4736DD.symbols
1304 Defl:N 580 56%01-28-2017 10:01 31754a59符号/ 2A066874-F58A-32D0-A75A-5427D6909F92.symbols
49808 Defl:N 9569 81%01-28-2017 10:01 e3f914e6符号/495698EB-ADEA-3C6E-873B-E9F330C364B1.symbols
1360 Defl:N 576 58%01-28-2017 10:01 b457ae89符号/ 4F5C1D31-2B0B-3D45-8307-FF3B01D6678F.symbols
22488 Defl:N 6471 71%01-28-2017 10:01 96e50d34符号/ 57A3E752-CD40-3D39-A10D-0F2156141CFA.symbols
22488 Defl:N 6476 71%01-28-2017 10:01 95497af9符号/ 5A33D6B3-ED31-3EFF-B518-B0F6B1AB518F.symbols
40600 Defl:N 9804 76%01-28-2017 10:01 3fa40def符号/ 5DD3704E-7D46-338B-AA57-875F447D0FDD.symbols
95120 Defl :N 20420 79%01-28-2017 10:01 613db8b1符号/ 66FB5EA4-9401-31BF-917F-ACDB029A1096.symbols
29064 Defl:N 8109 72%01-28-2017 10:01 1b159c06符号/ 6D71045D -16DE-3FEE-9F5C-A3EABD040E64.symbols
7472 Defl:N 2304 69%01-28-2017 10:01 374bc5dc符号/ 6F1E015 A-1EA3-3971-8A6F-88759034B452.symbols
28448 Defl:N 7894 72%01-28-2017 10:01 a515fee5符号/ 7613BAC0-954C-3275-BBD6-A8F94CA88169.symbols
95032 Defl :N 20242 79%01-28-2017 10:01 c928db8e符号/ 76EF8DA9-D2AE-340C-8557-18D201C56FC0.symbols
3625704 Defl:N 564948 84%01-28-2017 10:01 00d5d560符号/ 7907E56A -C876-3ADB-8063-60A0C3534C80.symbols
40656 Defl:N 9702 76%01-28-2017 10:01 d4193ca3符号/ 7C39C85D-94F2-34D8-BAD4-9FAA7FBA7A8A.symbols
3626128 Defl: N 564909 84%01-28-2017 10:01 dc118cdf符号/ 7E3DC2DA-66CA-3D75-930C-586D382ED244.symbols
40528 Defl:N 9797 76%01-28-2017 10:01 e3f2fc23符号/ 8E44CE26- 99D8-327D-9265-1832F45435E5.symbols
1304 Defl:N 580 56%01-28-2017 10:01 bd45ff3f符号/ 9D3B475B-430C-3E1A-8564-90709511BAA4.symbols
1253768 Defl:N 223986 82%01-28-2017 10:01 d9b84785符号/ 9DB043C4-9AE4-3C6D-9C0B-3F4122CCB651.symbols
49920 Defl:N 9508 81 %01-28-2017 10:01 48d5b4c2符号/ 9E5276F6-A162-3960-B721-2AEA6034A9D4.symbols
7240 Defl:N 2311 68%01-28-2017 10:01 3a7eb2d0符号/ A654D23D-3717-33EA -BFB4-B77C0BB3E29D.symbols
7240 Defl:N 2306 68%01-28-2017 10:01 cf9bc3af符号/ A9A21BC8-84F5-3F38-B617-05DB8ABA3F14.symbols
264072 Defl:N 48696 82% 01-28-2017 10:01 4423f05b符号/ AAEE95F5-56B7-3601-A0E5-C31446494F6A.symbols
261616 Defl:N 47707 82%01-28-2017 10:01 b4ea0b2d符号/ AC9C450C-CC64-357D- 8F60-F072AE05FA66.symbols
264224 Defl:N 48725 82%01-28-2017 10:01 2bfd857d符号/ C69555CE-9775-3AEA-9C03-65661C772503.symbols
1262592 Defl:N 226212 82%01 -28-2017 10:01 39303f9c符号/ D4705FA7-7406-3585-84C7-E914BFAB468F.symbols
1262808 Defl:N 226261 82%01-28-2017 10:01 83cf2100符号/ E6C789A6-E22E-3349-8319 -6EACF1400E2E.symbols
49952 Defl:N 9610 81%01-28-2017 10:01 c142402b符号/ E92BBA7C-157A-3649-8FE6-CD429381BB7 2.符号
95184 Defl:N 20425 79%01-28-2017 10:01 f91d04e0符号/ F78C47B6-F71D-3606-8235-BF2BDA33DDCC.symbols
I was using Swift in my one of the projects and finally it was time to upload it to the app store. The app size is a concern since downloading an app with larger size is not a user's choice. The app store size of the app was 40MB. It was okay until the android version was uploaded and it was 6MB. I have used app thinning in iOS app and it's still very large. I checked the ipa's (89MB) content and found there were swift libs included in the ipa file. I searched on the internet : Swift libraries included twice in IPA
Then internet convinced me that size of ipa (89MB) is different than the actual size(40MB) which is right. I can see the difference in ipa size and app store download size.
But the android version (6MB in size) is buzzing me.
So what went wrong?If I had used Objective-C
would app store size be different?
Edit: 17 Sep, 2018
This is from wwdc 2018
Edit: 23 Nov, 2017
Today I created store build with xcode 9 and found that the swift ipa size has increased from 59MB to 105MB but after uploading to iTunes connect the download size is around 2.5MB, that's cool! So there is very less overhead in terms of size of swift app over objc app.
Edit: 22 Nov, 2017
Today I checked the iTunes connect for the same app and found that new download size tab and it's showing less download size compared to last time experiment.
Old answer
I created two single view application with core data for iPhone. One in Swift and other in Objective-C. Both has default project template and didn't write any extra code. I added same app icons in both the projects.
Then created ipa from both the projects and uploaded on iTunesconnect as version 1 and 2
Then I checked both the ipa files using command unzip -lv
and found that there were three folders extra in Swift version of ipa
- Frameworks (67.09MB)
- SwiftSupport (66.56MB)
- Symbols (15.42MB)
When I compressed only these three folders (Frameworks+SwiftSupport+ Symbols) then compressed size is 59.5 MB. Whereas the total size of the ipa is 59.6MB. It's clear that Swift library is increasing the size of the app.
unzip -lv SizeSwiftTest.ipa
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
46125024 Defl:N 18988843 59% 01-28-2017 10:02 14b9d63c Payload/SizeSwiftTest.app/Frameworks/libswiftCore.dylib
743568 Defl:N 216552 71% 01-28-2017 10:02 79b72c24 Payload/SizeSwiftTest.app/Frameworks/libswiftCoreData.dylib
1137184 Defl:N 383891 66% 01-28-2017 10:03 86bd6df6 Payload/SizeSwiftTest.app/Frameworks/libswiftCoreGraphics.dylib
257616 Defl:N 24550 91% 01-28-2017 10:03 a6da0939 Payload/SizeSwiftTest.app/Frameworks/libswiftCoreImage.dylib
543696 Defl:N 176102 68% 01-28-2017 10:03 94937782 Payload/SizeSwiftTest.app/Frameworks/libswiftDarwin.dylib
2562272 Defl:N 954097 63% 01-28-2017 10:04 55a778fc Payload/SizeSwiftTest.app/Frameworks/libswiftDispatch.dylib
17463360 Defl:N 7412237 58% 01-28-2017 10:04 6f6526c0 Payload/SizeSwiftTest.app/Frameworks/libswiftFoundation.dylib
506192 Defl:N 165186 67% 01-28-2017 10:04 ad88cf40 Payload/SizeSwiftTest.app/Frameworks/libswiftObjectiveC.dylib
311520 Defl:N 60300 81% 01-28-2017 10:05 85363d5d Payload/SizeSwiftTest.app/Frameworks/libswiftQuartzCore.dylib
699712 Defl:N 273308 61% 01-28-2017 10:05 c7d7022a Payload/SizeSwiftTest.app/Frameworks/libswiftUIKit.dylib
45775648 Defl:N 18627456 59% 12-07-2016 05:23 81fe5af9 SwiftSupport/iphoneos/libswiftCore.dylib
741104 Defl:N 209836 72% 12-07-2016 05:23 4acecaad SwiftSupport/iphoneos/libswiftCoreData.dylib
1133696 Defl:N 374501 67% 12-07-2016 05:23 8b024942 SwiftSupport/iphoneos/libswiftCoreGraphics.dylib
256368 Defl:N 22243 91% 12-07-2016 05:23 325cc5a7 SwiftSupport/iphoneos/libswiftCoreImage.dylib
541792 Defl:N 170804 69% 12-07-2016 05:23 f41ed047 SwiftSupport/iphoneos/libswiftDarwin.dylib
2522368 Defl:N 932905 63% 12-07-2016 05:22 09cecc4f SwiftSupport/iphoneos/libswiftDispatch.dylib
17318784 Defl:N 7278280 58% 12-07-2016 05:22 4af20463 SwiftSupport/iphoneos/libswiftFoundation.dylib
504304 Defl:N 160214 68% 12-07-2016 05:22 1093b583 SwiftSupport/iphoneos/libswiftObjectiveC.dylib
310112 Defl:N 57522 82% 12-07-2016 05:23 a613dad2 SwiftSupport/iphoneos/libswiftQuartzCore.dylib
697344 Defl:N 266430 62% 12-07-2016 05:23 d6bf939b SwiftSupport/iphoneos/libswiftUIKit.dylib
22576 Defl:N 6387 72% 01-28-2017 10:01 b3c45d81 Symbols/1BFFD5D6-0677-33B3-BAEC-046295DEA090.symbols
29064 Defl:N 8112 72% 01-28-2017 10:01 d6c556b3 Symbols/2582C775-1993-3EB6-8824-D3F9A75ADE6D.symbols
3613720 Defl:N 559651 85% 01-28-2017 10:01 34544697 Symbols/26F02EDA-79FE-32B9-BD99-BD076B4736DD.symbols
1304 Defl:N 580 56% 01-28-2017 10:01 31754a59 Symbols/2A066874-F58A-32D0-A75A-5427D6909F92.symbols
49808 Defl:N 9569 81% 01-28-2017 10:01 e3f914e6 Symbols/495698EB-ADEA-3C6E-873B-E9F330C364B1.symbols
1360 Defl:N 576 58% 01-28-2017 10:01 b457ae89 Symbols/4F5C1D31-2B0B-3D45-8307-FF3B01D6678F.symbols
22488 Defl:N 6471 71% 01-28-2017 10:01 96e50d34 Symbols/57A3E752-CD40-3D39-A10D-0F2156141CFA.symbols
22488 Defl:N 6476 71% 01-28-2017 10:01 95497af9 Symbols/5A33D6B3-ED31-3EFF-B518-B0F6B1AB518F.symbols
40600 Defl:N 9804 76% 01-28-2017 10:01 3fa40def Symbols/5DD3704E-7D46-338B-AA57-875F447D0FDD.symbols
95120 Defl:N 20420 79% 01-28-2017 10:01 613db8b1 Symbols/66FB5EA4-9401-31BF-917F-ACDB029A1096.symbols
29064 Defl:N 8109 72% 01-28-2017 10:01 1b159c06 Symbols/6D71045D-16DE-3FEE-9F5C-A3EABD040E64.symbols
7472 Defl:N 2304 69% 01-28-2017 10:01 374bc5dc Symbols/6F1E015A-1EA3-3971-8A6F-88759034B452.symbols
28448 Defl:N 7894 72% 01-28-2017 10:01 a515fee5 Symbols/7613BAC0-954C-3275-BBD6-A8F94CA88169.symbols
95032 Defl:N 20242 79% 01-28-2017 10:01 c928db8e Symbols/76EF8DA9-D2AE-340C-8557-18D201C56FC0.symbols
3625704 Defl:N 564948 84% 01-28-2017 10:01 00d5d560 Symbols/7907E56A-C876-3ADB-8063-60A0C3534C80.symbols
40656 Defl:N 9702 76% 01-28-2017 10:01 d4193ca3 Symbols/7C39C85D-94F2-34D8-BAD4-9FAA7FBA7A8A.symbols
3626128 Defl:N 564909 84% 01-28-2017 10:01 dc118cdf Symbols/7E3DC2DA-66CA-3D75-930C-586D382ED244.symbols
40528 Defl:N 9797 76% 01-28-2017 10:01 e3f2fc23 Symbols/8E44CE26-99D8-327D-9265-1832F45435E5.symbols
1304 Defl:N 580 56% 01-28-2017 10:01 bd45ff3f Symbols/9D3B475B-430C-3E1A-8564-90709511BAA4.symbols
1253768 Defl:N 223986 82% 01-28-2017 10:01 d9b84785 Symbols/9DB043C4-9AE4-3C6D-9C0B-3F4122CCB651.symbols
49920 Defl:N 9508 81% 01-28-2017 10:01 48d5b4c2 Symbols/9E5276F6-A162-3960-B721-2AEA6034A9D4.symbols
7240 Defl:N 2311 68% 01-28-2017 10:01 3a7eb2d0 Symbols/A654D23D-3717-33EA-BFB4-B77C0BB3E29D.symbols
7240 Defl:N 2306 68% 01-28-2017 10:01 cf9bc3af Symbols/A9A21BC8-84F5-3F38-B617-05DB8ABA3F14.symbols
264072 Defl:N 48696 82% 01-28-2017 10:01 4423f05b Symbols/AAEE95F5-56B7-3601-A0E5-C31446494F6A.symbols
261616 Defl:N 47707 82% 01-28-2017 10:01 b4ea0b2d Symbols/AC9C450C-CC64-357D-8F60-F072AE05FA66.symbols
264224 Defl:N 48725 82% 01-28-2017 10:01 2bfd857d Symbols/C69555CE-9775-3AEA-9C03-65661C772503.symbols
1262592 Defl:N 226212 82% 01-28-2017 10:01 39303f9c Symbols/D4705FA7-7406-3585-84C7-E914BFAB468F.symbols
1262808 Defl:N 226261 82% 01-28-2017 10:01 83cf2100 Symbols/E6C789A6-E22E-3349-8319-6EACF1400E2E.symbols
49952 Defl:N 9610 81% 01-28-2017 10:01 c142402b Symbols/E92BBA7C-157A-3649-8FE6-CD429381BB72.symbols
95184 Defl:N 20425 79% 01-28-2017 10:01 f91d04e0 Symbols/F78C47B6-F71D-3606-8235-BF2BDA33DDCC.symbols
这篇关于与Objective-C应用程序相比,捆绑的Swift库的文件大小开销是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!