IOS 9 App Slimming feature

Source: Internet
Author: User
Tags set time spritekit

APP Slimming Introduction

There are a large number of IOS devices on the market today, so there are a number of screen sizes and resolutions that require a lot of resources (such as PNG, JPEG, and binary PDF) to make an App appear on multiple screens. Unfortunately, this has resulted in users needing to download a huge package (the previous IOS version forces users to download all the App files, including IPad adaptation images they will never use on IPhone). 16G IPhone still has a lot of people in use (and may not disappear for a short period of time), so you need to reduce the volume of your App so you can download it quickly and make sure you have enough space. The APP slimming feature makes it all possible.

In addition to the code and images, the APP now includes executable code as well as 32-bit, 64-bit versions (optimized for various architectures such as arm64, arm7s, and ARM7), 3D graphics technology (such as OpenGL, Metal, etc.), sounds, and other files. In short, the App is now incredibly complex. This is the problem that the APP needs to solve in slimming.

APP slimming automatically detects user device types (such as model names) and downloads relevant content for specific devices. In other words, if you use the IPad Mini 1 (no Retina screen, only 1 x resolution), then only 1 x files will be downloaded. More powerful and clearer resources (such as IPad Mini 3 or 4) will not be downloaded. Because users only need to download what he or she needs to use, this accelerates the download process and saves space on the device.

Although this may sound complicated at first, we will go deep into the specifics. Fortunately, Xcode and AppStore will do most of the work and developers will be much more relaxed. Therefore, there is not much code in this tutorial, but rather focus on understanding the process of App slimming and the techniques it uses.

App Slimming has three main aspects, application slicing ( App Slicing ), intermediate code (), Bitcode and loading resources on demand ( On Demand Resources ). In this tutorial, we'll cover each of them.

Application slicing (app slicing)

App Slimming The first thing we're going to talk about is slicing (slicing). According to Apple's documentation,

Slices are the process of creating and providing variants () of application packages for different target devices variant .

A Variant ( variant ) contains only the resources required to execute the schema and target devices. In other words, the application tiles only provide the resources associated with each device (depending on screen resolution and schema, etc.). In fact, application slicing has done most of the work of app slimming.

Suppose you are ready to submit the APP, and as before, you will upload it. IPA or. App file to ITunes connect (but you must use XCODE7 because it includes the IOS 9 SDK that supports APP slimming). Then AppStore will slice the App and create a specific variant ( variant ) that will be distributed to each device according to the function ( capabilities ).

Load resource on Demand (on Demand resources)

To fully understand the App slimming, you need to understand what is loading resources on demand ( ODR ). A resource that is loaded on demand is a file that needs to be downloaded after the APP is first installed. For example, specific levels of the game (and content related to those levels) can only be downloaded when the player unlocks. In addition, older levels that the player does not need can be removed after the set time is exceeded to save storage space on the device.

In Xcode settings (in Build Setting), turning on the on-demand load resource requires the "Enable on Demand Resources" change to "YES".

Intermediate code (BITCODE)

The last content of the App slimming is the middle code. The middle code is a bit abstract, but in essence, it is a new way for Apple to optimize it before the App is downloaded. The intermediate code allows the APP to execute as quickly and efficiently as possible on any device. The intermediate code automatically compiles the APP for the most recently used compiler and optimizes for specific architectures (such as arm64 64-bit processors, such as iphone6s and IPad Air 2).

The intermediate code is used in conjunction with other slimming techniques mentioned above to remove optimized content for other architectures and to download only the optimized content needed to reduce the size of the downloaded file.

In IOS, the intermediate code is a new feature and needs to be opened manually in a new project. This process can change the Enable bitcode to YES under Build Setting.

Use APP slimming in your project

Although Xcode and the app Store handle most of the process of slimming apps, you still need to take some precautions to make sure your app really uses this new technology. First of all, you must use the Resource directory ( asset catalogs ). At this point, most apps use the Resource Directory ( asset catalogs ) by default. If you are not using the Resource directory ( asset catalogs ), most of your existing content can be transferred to a directory, just click the "Use Asset Catalog" button in the Xcode project settings, as shown below.

One of the new features of Xcode is Sprite Atlases . Sprite Atlases is basically a combination of resource catalogs and SpriteKit (the technology used in Xcode to develop 2D games). Similarly, if you are using Spritekit,app to thin body is necessary.

Test APP Slimming

As you can see, Xcode and Apple AppStore have handled most of the app slimming process, so it's much easier to use this technology in your own app. But how do you test your app and make sure it already has app slimming? Fortunately, Apple's TestFlight offers the perfect solution. In addition to AppStore's application slimming technology, TestFlight Users can also experience this feature.

In the second part of this tutorial, we'll show you how to use App slimming in TestFlight.

First, download this basic blank item, unzip it, and run it in Xcode, and you'll notice that this project basically has nothing but a asset catalogs series of pictures (and a small amount of code) in the Resource Directory (). This resource directory ( asset catalogs ) also contains 1x, 2x, and 3x versions of App icons.

First, run the App on the emulator or the real machine. Open the Settings app, click on 存储和 iCloud 使用 this item (if it's not an IOS 9 device, point 存储 ) and select Manage storage space. Swipe down to the App we just compiled and click on it. You'll notice that it's probably 17.0 MB (this size may be slightly different when uploading to ITunes Connect).

When you build and run an app using Xcode, Xcode does not automatically process the app variants ( variant ) and thin the app, so the entire app file is on your device.

Next, click the tab in Xcode Product and select Archive .

Note that you might first need to modify the App Bundle Identifier to match an identifier that you created yourself. Otherwise, the App will not be uploaded to ITunes Connect.

Make sure you select Include bitcode before clicking "Submit". If all goes well, you will see a green checkmark informing you that this build has been uploaded.

Now sign in to itunes Connect and create a new app (with the appropriate bundle ID, App name, and so on). If you're not sure how to do this, see Appcoda TestFlight Tutorial.

Add yourself as an internal tester. Note that it is unusual for a build to remain "in process" for a few hours. Once the APP has finished processing, select it and press the Start Test button.

An email will be sent to your address. Make sure you're using the IOS device you want to test to open this email. You will enter the TestFlight application.

Install this build, once the installation is complete, go back to the Setup app, find the storage, and find the app as before. Note that this App is now close to 5.4 MB. This is the meaning of App slimming.

Oh, whoa! You just removed the 12.4 MB from your app-and it's just a very simple app. Apps that contain a variety of different resources ( asset ) are more effective.

Summarize

In this tutorial, we see the power of the App slimming. We discussed the three main aspects of app slimming: application Slicing ( App Slicing ), intermediate code ( Bitcode ), and loading resources on demand ( On Demand Resources ).

Unfortunately, on September 24, 2015, Apple announced in its developer portal that the APP slimming has been delayed and will not be included in the IOS 9 (or 9.0.1) public release:

Application tiles are not currently available for iOS 9 apps because ICloud creates iOS 9 backup problems and some apps in AppStore can only be restored to the same model of iOS device.

When users download your IOS 9 app, they get a generic version instead of a specific variant () for their device type vatiant . TestFlight will continue to distribute variants () to internal test users. The vatiant application tiles will be available in future software updates. Now you don't have to do anything.

However, as I mentioned in the beginning of the article, the APP slimming has been repaired and ready for all devices running IOS 9.0.2. App Slimming is an incredibly magical tool that will continue to accelerate app downloads.


IOS 9 App Slimming feature

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.