Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19069

IOS9: App thinning: Support on-demand resources for app thinning

    Details

    • Type: New Feature
    • Status: Open
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:

      Description

      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:

      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();
      

      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.

      <ios>
          <min-ios-ver>9.0</min-ios-ver>
      </ios>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                cng Chee Kiat Ng (Inactive)
              • Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code