0

我使用的是 Sencha Touch 2.1.1 版和 CMD 3.0.2.288 版。

我正在将工作的 2.0 应用程序转换为 2.1。

当我构建应用程序并运行它时,我收到指示无法加载视图的错误。当我在错误指示的路径中查看构建文件夹时,视图不存在。

这是错误:

http://localhost:8888/Mobile/build/a...24263186Failed to load resource: the server responded with a status of 404 (Not Found)

该应用程序在构建之前可以在 Safari 中完美运行。有没有人有任何想法?

编译的输出如下

Sencha Cmd v3.0.2.288
[INF]       
[INF]       init-properties:
[INF]       
[INF]       init-sencha-command:
[INF]       
[INF]       init:
[INF]       
[INF]       -before-app-build:
[INF]       
[INF]       app-build-impl:
[INF]       
[INF]       production:
[INF]       
[INF]       -before-init-local:
[INF]       
[INF]       -init-local:
[INF]       
[INF]       -after-init-local:
[INF]       
[INF]       init-local:
[INF]       
[INF]       find-cmd:
[INF]       
[INF]       -before-init:
[INF]       
[INF]       -init:
[INF]       
[INF]       -after-init:
[INF]       
[INF]       init:
[INF]       
[INF]       -before-build:
[INF]       
[INF]       sass:
[INF]       
[INF]       page:
[INF]       
[INF]       -before-page:
[INF]       
[INF]       -page:
[INF]       building application
[INF]       Deploying your application to /Applications/MAMP/htdocs/Mobile/build/app/production
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./app.js to /Applications/MAMP/htdocs/Mobile/build/app/production/app.js
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./resources/css/app.css to /Applications/MAMP/htdocs/Mobile/build/app/production/resources/css/app.css
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./resources/images
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./resources/icons
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./resources/loading
[INF]       Copied /Applications/MAMP/htdocs/Mobile/./resources/data
[INF]       Resolving your application dependencies (file:////Applications/MAMP/htdocs/Mobile/./index.html)
[INF]       Compiling app.js and dependencies
[INF]       Processing classPath entry : /Applications/MAMP/htdocs/Mobile/sencha-compile-temp-dir
[INF]       Processing classPath entry : /Applications/MAMP/htdocs/Mobile/touch/src
[INF]       Processing classPath entry : /Applications/MAMP/htdocs/Mobile/app.js
[INF]       Processing classPath entry : /Applications/MAMP/htdocs/Mobile/app
[INF]       Processing class inheritance graph
[INF]       Processing instantiation refereces to classes and aliases
[INF]       Processing source dependencies
[INF]       Concatenating output to file /Applications/MAMP/htdocs/Mobile/build/app/production/app.js
[INF]       Completed compilation.
[INF]       Processed remote file touch/sencha-touch.js
[INF]       Processed local file app.js
[INF]       Minified app.js
[INF]       Generated delta for: app.js from hash: '0cf2d66c793df3275db06ce3c88737d55b92c0ac' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: '3defd723a308dffa24d79abe9b36efaea9b7fa2c' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: '68b15cd8c4470cae367618d56d2221f750fe94c5' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: '7abfe02aa5647b33770d8584330c838c7228e6a3' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: '955de9ce50a676d272e4b81984164be49b347f01' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: 'bb51ed6de771efa962e01e67807e488d760b63a0' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: 'ce841c66ba0f08125ef8a850960c4b0366ef061f' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: 'd09ff9bd2f3c719c21fe44c3a7d6a2f3690bc816' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Generated delta for: app.js from hash: 'fbb192007fd273dd08359e426311be7688656b2a' to hash: '166f3da44e90c243ec58c2be30af4149922d4f2d'
[INF]       Minified resources/css/app.css
[INF]       Generated app.json
[INF]       Embedded microloader into index.html
[INF]       Generating appcache
[INF]       Generating checksum for appCache item: index.html
[INF]       Generating checksum for appCache item: resources/css/app.css
[INF]       Generating checksum for appCache item: resources/data/data.json
[INF]       Generating checksum for appCache item: resources/images/Billing.png
[INF]       Generating checksum for appCache item: resources/images/Billing@2x.png
[INF]       Generating checksum for appCache item: resources/images/Biochem.png
[INF]       Generating checksum for appCache item: resources/images/Biochem@2x.png
[INF]       Generating checksum for appCache item: resources/images/Contact.png
[INF]       Generating checksum for appCache item: resources/images/Contact@2x.png
[INF]       Generating checksum for appCache item: resources/images/Cyto.png
[INF]       Generating checksum for appCache item: resources/images/Cyto@2x.png
[INF]       Generating checksum for appCache item: resources/images/Disclosure.png
[INF]       Generating checksum for appCache item: resources/images/Disclosure@2x.png
[INF]       Generating checksum for appCache item: resources/images/FAQ.png
[INF]       Generating checksum for appCache item: resources/images/FAQ@2x.png
[INF]       Generating checksum for appCache item: resources/images/Feedback.png
[INF]       Generating checksum for appCache item: resources/images/Feedback@2x.png
[INF]       Generating checksum for appCache item: resources/images/IntegratedTesting.png
[INF]       Generating checksum for appCache item: resources/images/IntegratedTesting@2x.png
[INF]       Generating checksum for appCache item: resources/images/Molecular.png
[INF]       Generating checksum for appCache item: resources/images/Molecular@2x.png
[INF]       Generating checksum for appCache item: resources/images/S.png
[INF]       Generating checksum for appCache item: resources/images/S@2x.png
[INF]       Generating checksum for appCache item: resources/images/TestMenu.png
[INF]       Generating checksum for appCache item: resources/images/TestMenu@2x.png
[INF]       Generating checksum for appCache item: resources/loading/Default-LandscapeLeft~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Default-LandscapeRight~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Default-Landscape~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Default-PortraitUpsideDown~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Default-Portrait~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Default.png
[INF]       Generating checksum for appCache item: resources/loading/Default@2x.png
[INF]       Generating checksum for appCache item: resources/loading/Default~ipad.png
[INF]       Generating checksum for appCache item: resources/loading/Homescreen.jpg
[INF]       Generating checksum for appCache item: resources/loading/Homescreen~ipad.jpg
[INF]       Successfully deployed your application to /Applications/MAMP/htdocs/Mobile/build/app/production
[INF]       
[INF]       -after-page:
[INF]       
[INF]       run:
[INF]       
[INF]       -build:
[INF]       
[INF]       -after-build:
[INF]       
[INF]       build:
[INF]       
[INF]       -after-app-build:
[INF]       
[INF]       app-build:

这是我的 app.json:

{
    /**
     * The application's namespace, used by Sencha Command to generate classes
     */
    "name": "App",

    /**
     * List of all JavaScript assets in the right execution order.
     * Each item is an object with the following format:
     *      {
     *          "path": "path/to/script.js" // Relative path to this app.json file
     *          "update": "delta"           // (Optional)
     *                                      //  - If not specified, this file will only be loaded once, and
     *                                      //    cached inside localStorage until this value is changed.
     *                                      //  - "delta" to enable over-the-air delta update for this file
     *                                      //  - "full" means full update will be made when this file changes
     *
     *      }
     */
    "js": [
        {
            "path": "touch/sencha-touch.js"
        },
        {
            "path": "app.js",
            "update": "delta"
        }
    ],

    /**
     * List of all CSS assets in the right inclusion order.
     * Each item is an object with the following format:
     *      {
     *          "path": "path/to/item.css" // Relative path to this app.json file
     *          "update": "delta"          // (Optional)
     *                                     //  - If not specified, this file will only be loaded once, and
     *                                     //    cached inside localStorage until this value is changed to either one below
     *                                     //  - "delta" to enable over-the-air delta update for this file
     *                                     //  - "full" means full update will be made when this file changes
     *
     *      }
     */
    "css": [
        {
            "path": "resources/css/app.css",
            "update": "delta"
        }
    ],

    /**
     * Used to automatically generate cache.manifest (HTML 5 application cache manifest) file when you build
     */
    "appCache": {
        /**
         * List of items in the CACHE MANIFEST section
         */
        "cache": [
            "index.html",
            "resources/css/app.css",
            "resources/data/data.json",
            "resources/images/Billing.png",
            "resources/images/Billing@2x.png",
            "resources/images/Biochem.png",
            "resources/images/Biochem@2x.png",
            "resources/images/Contact.png",
            "resources/images/Contact@2x.png",
            "resources/images/Cyto.png",
            "resources/images/Cyto@2x.png",
            "resources/images/Disclosure.png",
            "resources/images/Disclosure@2x.png",
            "resources/images/FAQ.png",
            "resources/images/FAQ@2x.png",
            "resources/images/Feedback.png",
            "resources/images/Feedback@2x.png",
            "resources/images/IntegratedTesting.png",
            "resources/images/IntegratedTesting@2x.png",
            "resources/images/Molecular.png",
            "resources/images/Molecular@2x.png",
            "resources/images/S.png",
            "resources/images/S@2x.png",
            "resources/images/TestMenu.png",
            "resources/images/TestMenu@2x.png",
            "resources/loading/Default-LandscapeLeft~ipad.png",
            "resources/loading/Default-LandscapeRight~ipad.png",
            "resources/loading/Default-Landscape~ipad.png",
            "resources/loading/Default-PortraitUpsideDown~ipad.png",
            "resources/loading/Default-Portrait~ipad.png",
            "resources/loading/Default.png",
            "resources/loading/Default@2x.png",
            "resources/loading/Default~ipad.png",
            "resources/loading/Homescreen.jpg",
            "resources/loading/Homescreen~ipad.jpg"
            //"touch/sencha-touch.js",

        ],
        /**
         * List of items in the NETWORK section
         */
        "network": [
            "*"
        ],
        /**
         * List of items in the FALLBACK section
         */
        "fallback": [] 
    },

    /**
     * Extra resources to be copied along when build
     */
    "extras": [
        "resources/images",
        "resources/icons",
        "resources/loading",
        "resources/data"
    ],

    /**
     * Directory path to store all previous production builds. Note that the content generated inside this directory
     * must be kept intact for proper generation of delta between updates
     */
    "archivePath": "archive",

    /**
     * Default paths to build this application to for each environment
     */
    "buildPaths": {
        "testing": "build/testing",
        "production": "build/production",
        "package": "build/package",
        "native": "build/native"
    },

    /**
     * Build options
     */
    "buildOptions": {
        "product": "touch",
        "minVersion": 3,
        "debug": false,
        "logger": "no"
    },

    /**
     * Uniquely generated id for this application, used as prefix for localStorage keys.
     * Normally you should never change this value.
     */
    "id": "996b4be0-9f88-11e1-b590-67deda5f4cdb"
}

这是 app.js

Ext.Loader.setPath({
    'Ext': 'touch/src'
});


Ext.application({
    name: 'App',

    requires: [
        'Ext.MessageBox'
    ],

    views: [
        'Main',
        'Homepage',
        'Sections',
        'Detail',
        'RequisitionRequest'
    ],

    models: [
        'Sections'
    ],

    stores: [
        'Sections'
    ],

    controllers: [
        'Main'
    ],

    icon: {
        57: 'resources/icons/Icon.png',
        72: 'resources/icons/Icon~ipad.png',
        114: 'resources/icons/Icon@2x.png',
        144: 'resources/icons/Icon~ipad@2x.png'
    },

    phoneStartupScreen: 'resources/loading/Homescreen.jpg',
    tabletStartupScreen: 'resources/loading/Homescreen~ipad.jpg',

    launch: function() {
        // Destroy the #appLoadingIndicator element
        Ext.fly('appLoadingIndicator').destroy();

        // Initialize the main view
        Ext.Viewport.add(Ext.create('App.view.Main'));
        // Initialize the requisition request view
        //Ext.Viewport.add(Ext.create('App.view.RequisitionRequest'));
    },

    onUpdated: function() {
        Ext.Msg.confirm(
            "Application Update",
            "This application has just successfully been updated to the latest version. Reload now?",
            function(buttonId) {
                if (buttonId === 'yes') {
                    window.location.reload();
                }
            }
        );
    }
});
4

1 回答 1

2

问题解决了!以下片段位于我的 Main.js 视图的底部,我完全错过了它。在我删除它之后,应用程序在构建后可以正常运行。

/**
 * Fix for Bug TOUCH-2665 (Sencha Touch 2.0.1 RC)
 * must be removed in next release
 */
Ext.define('App.Tabfix', {
    override: 'Ext.tab.Panel',
    doTabChange: function(tabBar, newTab) {
        this.setActiveItem(tabBar.indexOf(newTab));
    }
});
于 2013-03-15T03:52:50.403 回答