最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Sencha touch 2 native build not loading - Stack Overflow

programmeradmin1浏览0评论

After generating the default app with:

sencha generate app Sencha ../Sencha

I decided to test the app on the iOS simulator

cd ../Sencha/
sencha app build native

It loads the app but gets stuck on the loading icon:

Below is the code for the main application (App.js):

Ext.application({
    name: 'Sencha',

    requires: [
        'Ext.MessageBox'
    ],

    views: ['Main'],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/[email protected]',
        '144': 'resources/icons/[email protected]'
    },

    isIconPreposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },

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

        // Initialize the main view
        Ext.Viewport.add(Ext.create('Sencha.view.Main'));
    },

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

Below is the code for the main view (Main.js):

Ext.define("Sencha.view.Main", {
    extend: 'Ext.tab.Panel',
    requires: [
        'Ext.TitleBar',
        'Ext.Video'
    ],
    config: {
        tabBarPosition: 'bottom',

        items: [
            {
                title: 'Wele',
                iconCls: 'home',

                styleHtmlContent: true,
                scrollable: true,

                items: {
                    docked: 'top',
                    xtype: 'titlebar',
                    title: 'Wele to Sencha Touch 2'
                },

                html: [
                    "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
                    "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
                    "and refresh to change what's rendered here."
                ].join("")
            },
            {
                title: 'Get Started',
                iconCls: 'action',

                items: [
                    {
                        docked: 'top',
                        xtype: 'titlebar',
                        title: 'Getting Started'
                    },
                    {
                        xtype: 'video',
                        url: '.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
                        posterUrl: '.jpg'
                    }
                ]
            }
        ]
    }
});

After generating the default app with:

sencha generate app Sencha ../Sencha

I decided to test the app on the iOS simulator

cd ../Sencha/
sencha app build native

It loads the app but gets stuck on the loading icon:

Below is the code for the main application (App.js):

Ext.application({
    name: 'Sencha',

    requires: [
        'Ext.MessageBox'
    ],

    views: ['Main'],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/[email protected]',
        '144': 'resources/icons/[email protected]'
    },

    isIconPreposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },

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

        // Initialize the main view
        Ext.Viewport.add(Ext.create('Sencha.view.Main'));
    },

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

Below is the code for the main view (Main.js):

Ext.define("Sencha.view.Main", {
    extend: 'Ext.tab.Panel',
    requires: [
        'Ext.TitleBar',
        'Ext.Video'
    ],
    config: {
        tabBarPosition: 'bottom',

        items: [
            {
                title: 'Wele',
                iconCls: 'home',

                styleHtmlContent: true,
                scrollable: true,

                items: {
                    docked: 'top',
                    xtype: 'titlebar',
                    title: 'Wele to Sencha Touch 2'
                },

                html: [
                    "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
                    "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
                    "and refresh to change what's rendered here."
                ].join("")
            },
            {
                title: 'Get Started',
                iconCls: 'action',

                items: [
                    {
                        docked: 'top',
                        xtype: 'titlebar',
                        title: 'Getting Started'
                    },
                    {
                        xtype: 'video',
                        url: 'http://av.vimeo./64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
                        posterUrl: 'http://b.vimeocdn./ts/261/062/261062119_640.jpg'
                    }
                ]
            }
        ]
    }
});
Share Improve this question asked Jul 24, 2012 at 21:39 evolutionxboxevolutionxbox 4,1326 gold badges38 silver badges57 bronze badges 4
  • 2 I'm stuck with the same problem. Did you find the solution yet ? If so, please edit your question and post it ! – user645579 Commented Aug 16, 2012 at 4:51
  • Did you resolved your problem? I have similar issue. – svlada Commented Jan 24, 2013 at 14:00
  • I haven't had time to check yet. I will soon. – evolutionxbox Commented Jan 29, 2013 at 17:25
  • I don't think I ever did find a solution btw. – evolutionxbox Commented Mar 30, 2021 at 21:34
Add a ment  | 

3 Answers 3

Reset to default 3 +50

Change the "logger": "no" to "logger": "false" in app.json. When you're done it should look like this:

"buildOptions": {
    "product": "touch",
    "minVersion": 3,
    "debug": false,
    "logger": "false"
},

Then rebuild again with sencha app build native. You can reproduce the same error in the browser with sencha app build production then point your browser to http://localhost/path/to/myapp/build/production. If you do, you'll have to clear your browser cache before it'll work (on chrome: wrench->tools-developer tools->local storage->hostname->X (for delete).

The build process creates the minified version during the build process. Start it in the browser and check what the error console says.

so this is really late, but it looks like you haven't marked your question as answered, and I've just spent a couple of hours trying to figure this out, and it turns out that all of this is because of discrepancies between the Sencha Docs, the Sencha SDK Tools for downloading, and the actual Sencha SDK.

Hopefully this will help someone -

A basic app needs to be started with Sencha Command 3.0.0 (not the SDK Tools, which worked for Sencha 2.0) if you're SDK is version 2.1.0 or above. If you get the Sencha Command bit working properly (installing it didn't put it in the PATH for me, so I had to manually add it) everything works like a charm.

http://docs.sencha./touch/2-1/#!/guide/mand

Hope that helps some stragglers!

发布评论

评论列表(0)

  1. 暂无评论