How can Apple continue offering 16GB base models? ODR!
ODR stands for On Demand Resources and it’s a new API introduced in iOS 9. It allows developers to host static assets that their apps need on Apple’s servers, and load them dynamically when required.
This will turn all apps using ODR into network apps. ODR is an element of their App Thinning initiative, which also includes App Slicing and Bitcode. Altogether, these techniques will allow Apple to continue shipping devices with 16GB base models, because it will now have much greater power to purge content from device local storage.
How ODR works #
This is how you should look at your app with ODR.
There’s the base, which includes your executable code written in Swift, Objective-C, etc. And all the base resources used universally within your app. Everything else is managed by tagging your content in Xcode, and then using
NSBundleResourceRequest to fetch your resources when needed.
NSBundleResourceRequest is a state machine with the states above. To use it, here’s a list of the basic methods.
Data retrieval patterns #
There are three patterns, as outlined during WWDC 2015, that you must think about when designing your system. Here’s a brief description.
- Random - tag small groups of assets
- Limited prediction - use many tags
- Linear - download well in advance
All of these influence the ODR timeline.
This is key. By using ODR, you inform the OS which parts of your app are primary and which are secondary. This reduces the initial download size from the App Store, but it also influences storage management on the device.
Everything you download using
NSBundleResourceRequest, assuming there’s enough space, is cached by the OS. This saves you from having to download resources every time the user opens the app. But if the OS comes under storage pressure, it will eventually start purging the cache, and with it, your ODR data.
By tagging your content, you separate it into asset packs that have a certain size. When purging the cache, the OS will remove entire asset packs to free up enough space. To inform this process, you may set
preservation priority for your asset packs. This priority does not influence decisions on a cross-app basis.
This is just a tiny snippet about ODR, I highly recommend watching they WWDC session on this topic.
The bottom line is, this is a good development, but I fear that, along with other App Thinning techniques, this will only alleviate the pressure Apple already had, to bump the storage for base models above 16GB. With the next iPhone model on the horizon, it is almost certain that they will keep the same storage options as before.
Given their margins and the fact that 16GB of iPhone memory only costs $91, it really upsets me that so many users will have to make a decision - go with the base 16GB model, or pay $100 extra for 64GB. Very often, the first option is most preferable.