Approaching Size Limit - The size of watch application (50MB limit is headache.)

半世苍凉 提交于 2019-12-19 20:24:06

问题


Our app reaches approx 49MB and we are not halfway. So definitely it will exceed the limit of 50MB. I have few questions as follow.

1) Is On-Demand Resources possible in watchOS?

2) My resources(images, custom fonts) make 2 copy each one is watch app and other is watch extension. How to solve that?

3) Swift core and other swift frameworks are consuming about ~28MB of space. is there any way to disable that? (PS. we have bit code disabled)

Edit for watchOS4:

Previously our app size was 44.3 MB but when we generate IPA from xcode9 size increased to 54.5.


回答1:


You can definitely save space by only including resources in either the watch app or the watch extension, not both. For resources used in your storyboard or referenced by name in WatchKit methods, like WKInterfaceImage’s setImageNamed(_:) method, you should store them in the watch app itself. For any resources loaded in code by path or with UIImage methods like init?(named:), you’ll want to put them in your WatchKit Extension.




回答2:


Following things can help to reduce size:

1) Try to use either swift or objective c

2) Add assets in either in a watch or watch extensions, according to requirement.

3) Enable bit code

4) go to the extension's project settings, and set Always Embed Swift Standard Libraries to No.

Update WatchOs4:

We have investigated size increase in watchos4. Finally, we find out that dylibs consuming memory.

libSwiftCode was 16.1mb in watchos3 now it's 23.1mb

libSwiftFoundation was 6.2mb in watchos3 now it's 9.2mb

Note:

From watchOS4 size increased by 25MB, so now watch app size limit is 75MB instead of old 50MB




回答3:


To answer your first question, yes on-demand resources is an available option for watchOS. See here and here

Additionally, the first link above describes 'slicing' which allows you to specify resources to target devices, thus reducing your overall app footprint.

To address your third question, go to the extension's project settings, and set Always Embed Swift Standard Libraries to 'No'.

Also, remove the Newtonsoft.Json library from the watch extension project, if it exists



来源:https://stackoverflow.com/questions/43278180/approaching-size-limit-the-size-of-watch-application-50mb-limit-is-headache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!