3. What’s App Thinning
New feature in iOS and watchOS
According to variant devices to optimize App
App size
Efficiency
Spacing
Minimal footprint
Three components of App thinning
Slicing
Bitcode
On-demand resources
4. Slicing (iOS)
Slicing is the process of creating and delivering
variants of the app bundle for different target
devices.
7. How to use the capability
Just one additional step during run or distributing App.
After completed the step, developer can export variant of app bundle to
test, or run on simulator.
Slicing (iOS)
8. The step can help you
Specific App bundle resource for variant of devices to reduce App size.
Ex: iPhone 6 plus will only download the App bundle of ARM 64 bit
architecture @3x image resource.
The most important
Slicing is only supported on latest iTunes and iOS 9.0 or later
Image resource must establishes on asset catalogs
If image resources come from external asset, make a simple folder
structure and JSON markup
Slicing (iOS)
10. Using custom folder to adapt slicing
Simple folder structure, just like Xcode asset but must have JSON
markup
Place any resource within xcasset folder reference
Slicing (iOS)
11. Must included JSON
Markup to tell system
how to retrieve image
Slicing (iOS)
12. “Bitcode is an intermediate representation of a compiled
program.” - App Distribution Guide
It is the same as byte code, but compiled by llvm.
Sent it to Apple which allow Apple to re-optimize you App without new
version App
In iOS is default but optional, but required in watchOS.
Bitcode (iOS, watchOS)
13. On-Demand Resources (iOS)
On-demand resources are that separated App
resources and hosted on Apple servers.
Download what user needs to download
More space efficiency
Remove resources when they are no
longer needed and disk space is low
Work transparently in the background
Ex: A game App
18. On-Demand Resources (iOS)
Setting up On-Demand Resources
https://developer.apple.com/library/prerelease/ios/documentation/
FileManagement/Conceptual/On_Demand_Resources_Guide/
index.html#//apple_ref/doc/uid/TP40015083-CH2-SW1
Using NSBundleResourceRequest to manage On-
Demand Resource
Request access to on demain resource
Update the priority of a download
Track the progress of a download
Notifying the OS when access is no longer needed
Check for a notification of low disk space
19. On-Demand Resources (iOS)
Request access to on demain resource
Tags of one App Bundle is managed by one instance of
NSBundleResourceRequest
Request resources before user need (ex: In game, load stage 2 in stage 1)
Step1 - Initial NSBundleResourceRequest
20. On-Demand Resources (iOS)
Step2 - Requesting access to the on-demand resources
Download the resources from the App store
a. error == nil (downloaded successfully)
b. callback is not at main thread
Does not download the resources
a. only check resources available in local
b. resourceAvailable = NO (resources are not ready)
22. On-Demand Resources (iOS)
Update the priority of a download
Change priority to ensure OS resources - App performance
Priority can be changed any time, including during the download.
Track the progress of a download
24. On-Demand Resources (iOS)
Notifying the OS when access is no longer needed
When resources end access, allow the OS to release the storage on the
device
Two way end access
1. Send endAccessingResources
2. Deallocate the resource request
26. On-Demand Resources (iOS)
Check for a notification of low disk space
Notification send out when it is no enough space for current request
27. On-Demand Resources (iOS)
Debugging On-Demand Resources
Three main categories of problems: Networking connectivity, local
storage space, and Unexpected State
Check unexpected state in Xcode