Top Banner
App Thinning Neo
30

App thinning

Aug 18, 2015

Download

Software

Yi-Shou Chen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: App thinning

App Thinning

Neo

Page 2: App thinning

OutlineWhat’s App Thinning in iOS 9 Slicing (iOS) Bitcode On-demand Resources

Page 3: App thinning

What’s App ThinningNew 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

Page 4: App thinning

Slicing (iOS)Slicing is the process of creating and delivering variants of the app bundle for different target devices.

Page 5: App thinning

App always have universal resource, and that’s very fat.

Slicing (iOS)

Page 6: App thinning

Slicing can export variant of the App bundle

Slicing (iOS)

Page 7: App thinning

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)

Page 8: App thinning

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)

Page 9: App thinning

Using asset catalogs to adapt slicing

Slicing (iOS)

Page 10: App thinning

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)

Page 11: App thinning

Must included JSON Markup to tell system how to retrieve image

Slicing (iOS)

Page 12: App thinning

“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)

Page 13: App thinning

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 nolonger needed and disk space is low Work transparently in the background

Ex: A game App

Page 14: App thinning

On-Demand Resources (iOS)

Page 15: App thinning

On-Demand Resources (iOS)

Page 16: App thinning

On-Demand Resources (iOS)

Page 17: App thinning

On-Demand Resources (iOS)What type of resources can be on-demand

On-Demand Resource Size Limits

Page 18: App thinning

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

Page 19: App thinning

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

Page 20: App thinning

On-Demand Resources (iOS)Step2 - Requesting access to the on-demand resources

Download the resources from the App storea. 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)

Page 21: App thinning

On-Demand Resources (iOS)

Page 22: App thinning

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

Page 23: App thinning

On-Demand Resources (iOS)Pausing and Canceling

Page 24: App thinning

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

Page 25: App thinning

On-Demand Resources (iOS)Setting Preservation Priority

OS will purge tags from lowest preservation priority

Page 26: App thinning

On-Demand Resources (iOS)Check for a notification of low disk space

Notification send out when it is no enough space for current request

Page 27: App thinning

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

Page 28: App thinning

On-Demand Resources (iOS)Unexpected State list

Page 29: App thinning

References

WWDC 2015 Section 404 - App Thinning in Xcode

https://developer.apple.com/videos/wwdc/2015/?id=404

App Distribution Guide https://developer.apple.com/library/prerelease/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html

On-Demand Resources Guide https://developer.apple.com/library/prerelease/ios/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/index.html#//apple_ref/doc/uid/TP40015083

Page 30: App thinning

Q & A