Based on what, iOS App slicing works? Is there any

2019-07-09 07:06发布

问题:

I have been studying iOS 9 features and went through the concept of App Thinning.

I have read from Apple documentation for App slicing (a part of App thinning) saying that:

Slicing is the process of creating and delivering variants of the app bundle for different target devices. A variant contains only the executable architecture and resources that are needed for the target device. You continue to develop and upload full versions of your app to iTunes Connect. The store will create and deliver different variants based on the devices your app supports. Image resources are sliced according to their resolution and device family.

So, based on that I can understand that if I define images as @1x @2x @3x, then if user has iPhone 6 plus, then only @3x images would be downloaded. But what about other resources?

Would I have to write any code for App slicing? And what are the other ways that I can benefit App thinning apart from the images?

回答1:

App Slicing not only supports images based on 1x, 2x and 3x, but it also supports Metal, audio, Sprite atlases etc. An app structure is depicted as follows:

It is clear that other than images, OpenGL ES, Metal, Audio and processor specific codes are in an app bundle. In app slicing, appropriate resources are selected based on the device to which the app is downloaded.

The only thing to do is to use asset catalogs. The thing to here is to add files in the asset catalogs

As per apple, Slicing is performed during your normal development and distribution workflows, which proceed generally as follows:

In Xcode, specify target devices and provide multiple resolutions of images in the asset catalog. You must use the asset catalog in order for resources to be sliced.

Build and run the app in Simulator or on a device. Xcode builds a variant of the app for the selected device type, improving the debug build time and allowing you to test variants locally.

Create an archive of the app and export a variant locally for target devices. Test all the variants you export on target devices to discover configuration issues early.

Upload the app to iTunes Connect. The store creates individual app variants from the archive. The number of variants depends on the architectures and resources specified in the Xcode project.

In iTunes Connect, distribute a prerelease version of your app to designated testers. Testers install the prerelease version on supported devices using TestFlight. TestFlight downloads a variant of the app specific to the user’s device.

Note: To test the variants that the store builds before you distribute your app to users, invite internal testers (your team’s iTunes Connect users) only and download the variants using TestFlight. If you invite external testers (users specifying only their email addresses), the external testers must wait for Beta App Review to approve the app before they can download variants. In iTunes Connect, release the app. Users install the app on supported devices, and the store app downloads a variant of the app specific to the user’s device.

Read more here at App Distribution Guide