after IOS9 was released, a bug was created that made the App thinning not work properly. In the iOS9.0.2 version, this bug has been fixed and the App thinning is ready to work. Be aware of this when you download apps from the App Store (App Store).
IOS9 was popular after the launch. In just a few weeks, more than half of IOS devices have installed the new system. This is the fastest adoption in the history of IOS-even breaking the 2013-year iOS7 record.
With regard to IOS9, I recently published an article called Search APIs and Sfsafariviewcontroller, and today, I will continue to explore the iOS9 on another exciting feature--app thinning (application slimming). In this tutorial, we'll explore why app thinning is important and how to use this exciting feature on your own app.
According to WWDC (Apple Global Developer Conference), APP thinning is a new technology that can change the entire download process. With many users responding, high traffic costs, limited storage space for IOS devices, and increased download speeds, App thinning is worth learning to adapt to these problems. In addition, the release of APP thinning has been postponed, and now is the best time to learn about this new technology.
Pre-conditions
In this tutorial, I assume that you have Xcode experience and know how to use the IDE. If you don't know anything about it or are unsure of what the IDE is, you might want to take a look at the excellent free courses related to this.
In addition, I suppose you know how to publish apps on the app Store and how to use Apple's Beta app test service testflight. The author does not specify how to use TestFlight, so if you are not familiar with testflight or do not know the general process of uploading the release app, I recommend you first look at this article on the Appcoda in addition to these and you learn the will, there is no preconditions.
Let's start with that as a prerequisite.
Introduction to APP thinning
Today, there are a variety of iOS devices on the market, screen size and resolution, which makes an app look good on a variety of screens, requires a lot of optimization resources (PNG format, JPEG format, vector PDF file, etc.) to match different sizes of screens. Worse, this results in a significant increase in user downloads. (The previous IOS version forces the user to download the entire app file, even if the user is using an iphone and needs to download an ipad image file they will never use) the 16g iphone still exists (it won't disappear in a short time), so make your app leaner and faster To ensure that users have sufficient space and to optimize the user experience. APP thinning makes it all possible.
Today, apps are no longer made up of simple code and images. Modern applications include not only executable code, but also different 32-bit, 64-bit versions (optimized for many architectures such as arm64, arm7s, and ARM7), 3D graphics technology (such as OpenGL, Metal, and so on), as well as audio and other different files. In short, apps are incredibly complex today. This is where App thinning play a role.
APP thinning automatically detects the user's device type (that is, the model name) and downloads only the content that is applicable to the current device. In other words, if you are using the IPad Mini 1 (1x resolution and non-Retina display) then only the files used by the 1x resolution (more in the following section) will be downloaded. The resources used by the more powerful and higher-resolution ipad (such as ipad Mini 3 or 4) will not be downloaded. Because users only need to download the content they need for the specific device they are currently using, this not only speeds up the download speed, but also saves the device's storage space.
Although it may sound a bit complicated at first, the author will dig into the details. Fortunately, most of this work is done by Xcode and the App Store, which makes the developer's life a lot easier. Therefore, the focus of this tutorial is on the deep understanding of App thinning and its implementation techniques, and there will be no large amount of code.
App thinning has the following three main aspects: app slicing (partition of application), Bitcode and loading resources on demand. In this tutorial, I will detail each aspect.
App Slicing
On the App thinning, the first aspect of this article is to divide the problem. According to Apple's official literature, "slicing is the process of creating and distributing different variants for application bundles to suit different target devices. A variant contains only the executable schema and resources for a target device. In other words, App slicing only transmits resources related to the device (depending on screen resolution, architecture, and so on). In fact, app slicing is responsible for handling the main process of app thinning.
When you are ready to submit your app, you will usually (but must use XCODE7 because it contains the iOS9 SDK that supports app thinning) to upload to Ittunes Connect. IPA or. APP files. Then, the App Store splits the app, creating a specific variant to fit the performance of the different devices.
On Demand Resources
load Resources On Demand
To fully understand the App thinning, you have to understand the on-demand loading of resources (on Demand resource, ODR). Loading resources On demand is a file that you can download after the app is installed for the first time. For example, when a player unlocks a specific level of a game, it can download a new level (and specific content related to the level). In addition, the levels that the player has passed can be removed to conserve storage space on the device.
Turning on the on-demand load resource feature involves changing the settings in Xcode (under Compilation settings (build Settings)), and "Enable load resources on demand" check yes.
Bitcode
The last aspect of App thinning is bitcode. Bitcode is somewhat abstract, but in essence it is also a new way for Apple to optimize apps before users download them. Bitcode allows apps to run quickly and efficiently on any device. Bitcode uses the latest compilers to automatically compile the app and optimize for specific architectures. (for example, arm64 for 64-bit processors such as the IPhone 6s and IPad Air 2)
Bitcode does not download apps optimized for different architectures, but downloads only the optimizations associated with specific devices, making it less downloadable and working closely with the App thinning technology described earlier.
Bitcode is a newer feature on IOS and needs to be opened manually for new projects. This can be done by selecting the project settings under Build Settings (Compile settings), and setting Bitcode to YES.
apply app thinning in your project
While Xcode and app thinning are responsible for handling the main process of app thinning, there are some precautions you should take to ensure your app supports this new technology. First, you must use the asset catalog. The asset catalog is enabled by default on most apps. If you have not enabled the asset catalog, many of the existing files can be transferred to the directory by clicking "Enable Asset Catalog" in the Xcode project settings.
Sprite Atlases is a new feature in Xcode7. Sprite Atlases is essentially a combination of asset catalogs and the core of SpriteKit (the technology that Xcode uses to create 2D games). So, if you use SpriteKit, then app thinning is a must.
test of App thinning
As mentioned above, Xcode and the app Store handle most of the app thinning processes, making this technology truly easy to apply to your app. But what if you want to test your app to make sure it's ready for app thinning? Fortunately, Apple's TestFlight provides us with the perfect solution.
In the second half of this tutorial, I'll explore how to use App thinning on TestFlight.
First, download this almost blank project, unzip it, and run it in Xcode. You will find that there is not much content in the project except for a few images in the asset directory (without a lot of code). The asset catalog also contains the 1x, 2x, and 3x versions of the app icon.
First, run the app on the emulator or device. Open the Settings app, click Storage and ICloud usage (only storage on 9 devices other than IOS), and then select Manage storage space. Scroll down to find the application that you just compiled, and then click it. You will find that it is approximately 17.0 MB in size (the size may be slightly different when uploading to ITunes Connect).
Aa
When you use Xcode to compile and run an app, Xcode does not automatically handle application variants and app thinning. This way, the entire application file is still on your device.
Then click on the Xcode product options (Product tab) and select Archive (Archive).
Note: You may need to modify the application Bundle Identifier to match the program you created yourself. Otherwise, the app will not upload to ITunes Connect.
Make sure that you select Include bitcode"before you select Submit. If all goes well, you will see a green checkmark indicating that your project has been successfully updated.
Now click here to login to ITunes Connect and create a new application (fill in the appropriate bundle ID, application name, etc.). If you are unsure what to do, refer to the Appcoda TestFlight tutorial.
Add yourself as an internal tester. Note that it is unusual to be in a "processing state" for several hours while the project is being built. Once the application has finished processing, select it and press Start test.
You will receive an email. Be sure to use the IOS device you want to test and accept the email invitation. You will be taken to the TestFlight application.
Install this version. Once completed, return to the application settings, browse the store, and find our previous application. Discover that the app is now only 5.4MB. This is the masterpiece of App thinning!
Wow! You have a very streamlined application that saves up to 12.4MB of storage space. Then, an application with multiple different resources will get a more significant size change!
Reference Links:
Http://www.cocoachina.com/ios/20150612/12135.html
http://www.jianshu.com/p/330303ac0410
2. Official website Link:
http://help.apple.com/xcode/mac/current/#/devbbdc5ce4f
Official documents
APP Thinning Overview (IOS, TvOS, WatchOS)
The app Store and operating system optimize the installation of IOS, TvOS, and WatchOS apps by tailoring App delivery to T He capabilities of the user ' s particular device, with minimal footprint. This optimization, called app thinning, lets you create apps-the most device features, Occupy minimum di SK space, and accommodate future updates, the can is applied by Apple. Faster downloads and more space for other apps and content provides a better user experience.
Slicing (IOS, TvOS)
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 is needed for the target device. You continue to develop and upload full versions of the Your app to ITunes Connect. The app Store would create and deliver different variants based on the devices your App supports. Use asset catalogs So then the App Store can select images, GPU resources, and other data appropriate for each device Vari Ant. When the user installs an app, a variant for the user's device is downloaded and installed.
Xcode simulates slicing during development so you can create and test variants locally. Xcode slices your app when your build and run your app on a device or in Simulator. When you create a archive, Xcode includes the full version of the Your app but allows your to export variants from the archive .
Note:sliced apps is supported on devices running 9.0 and later; Otherwise, the APP Store delivers universal apps to customers.
Bitcode
Bitcode is an intermediate representation of a compiled program. Apps upload to ITunes Connect that contain bitcode'll be compiled and linked on the App Store. Including Bitcode'll allow Apple to re-optimize your app binary on the future without the need to submit a new version O F your app to the app Store.
For IOS apps, Bitcode are the default, but optional. For WatchOS and TvOS apps, Bitcode is required. If you provide Bitcode, all apps and frameworks in the app bundle (all targets on the project) need to include Bitcode.
Xcode hides your app ' s symbols by default, so they is not readable by Apple. When you upload your app to ITunes Connect, you have the option of including symbols. Including symbols allows Apple to provide crash reports for your apps when you distribute your app using TestFlight or dist Ribute your app through the app Store. If you ' d like to collect and symbolication crash reports yourself, you don't have to upload symbols. Instead, you can download the Bitcode compilation DSYM files after you distribute your app.
On-demand Resources (IOS, TvOS)
On-demand Resources is resources-such as images and sounds-that can tag with keywords and request in groups, by tag. The APP Store hosts the resources on Apple servers and manages, the downloads for you. The app Store also slices On-demand resources, further optimizing variants of the app.
On-demand resources provide a better user experience:
APP sizes is smaller so apps download faster, improving the first-time launch experience.
On-demand resources Download In the background, as needed and while the user explores your app.
The operating system purges On-demand resources when they was no longer needed and disk space is low.
For example, a Master-detail app may divide resources to levels and request the next level of resources only when the AP P anticipates that the user would move to this level. Similarly, the app can request In-app Purchase resources only when the user makes the corresponding In-app Purchase.
Note:if distribute your app to registered devices (outside of the app Store), you must host the On-demand resources y Ourself.
To set the On-demand resources in your app, read the On-demand Resources Guide and Nsbundleresourcerequest.
Is this help page useful? Send feedback.
IOS9 app thinning (app slimming) feature Introduction