Project: titanium
Issue TIMOB-19069: IOS9: App thinning: Support on-demand resources for app thinning
*Overview:* The On-Demand-Resources provide a way to load resources only when requested. The resources are grouped into tags, which is done through Xcode (also need to figure out, how to do this on proxy side). The Idea is, to supply an easy way to access and download resources and release them after there are not needed anymore as part of the app thinning process. The current progress can also be tracked, as well as warnings regarding low memory. *Demo code:* {code} var win = Ti.UI.createWindow({ backgroundColor: "#fff", layout: "vertical" }); var manager = Ti.App.iOS.createOnDemandResourcesManager(); var beginButton = Ti.UI.createButton({ title: "Access Resources", top: 50 }); var resultProgress = Ti.UI.createProgressBar({ top: 50, min: 0, max: 1, width: 300, height: 10, value: 0.0 }); var resultImage = Ti.UI.createImageView({ top: 50, height: 100, image: "titanium.png" }); beginButton.addEventListener("click", function() { manager.conditionallyBeginAccessingResources({ tags: ["appc"], success: function(e) { resultImage.setImage("titanium"); // Resources are now accessible. Ti.API.warn(e); }, error: function(e) { // Accessing the resources failed. Ti.API.error(e); } }); }); manager.addEventListener("progress", function(e) { Ti.API.warn(" -- PROGRESS --"); Ti.API.warn(e); resultProgress.setValue(e.value); }); win.add(beginButton); win.add(resultProgress); win.add(resultImage); win.open(); {code} *Apple docs:* https://developer.apple.com/library/prerelease/ios/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/ *Note:* On demand resources are only available for iOS9. that means for developers who wants this, they have to set the minimum iOS version as 9.0 otherwise it won't compile. Just do this in tiapp.xml. {code} 9.0 {code}
Story points: 13