【问题标题】:Sencha touch 2 native build not loadingSencha touch 2 原生构建未加载
【发布时间】:2012-07-24 21:39:40
【问题描述】:

生成默认应用后:

sencha generate app Sencha ../Sencha

我决定在 iOS 模拟器上测试应用程序

cd ../Sencha/
sencha app build native

它会加载应用程序但卡在加载图标上:

以下是主应用程序(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/Icon@2x.png',
        '144': 'resources/icons/Icon~ipad@2x.png'
    },

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

下面是主视图(Main.js)的代码:

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

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

                styleHtmlContent: true,
                scrollable: true,

                items: {
                    docked: 'top',
                    xtype: 'titlebar',
                    title: 'Welcome 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.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
                        posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg'
                    }
                ]
            }
        ]
    }
});

【问题讨论】:

  • 我遇到了同样的问题。你找到解决方案了吗?如果是这样,请编辑您的问题并发布!
  • 您的问题解决了吗?我有类似的问题。
  • 我还没来得及检查。我很快就会的。
  • 顺便说一句,我想我从来没有找到解决方案。

标签: javascript ios json sencha-touch-2


【解决方案1】:

app.json 中的"logger": "no" 更改为"logger": "false"。完成后应该如下所示:

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

然后使用sencha app build native 再次重建。您可以使用sencha app build production 在浏览器中重现相同的错误,然后将浏览器指向http://localhost/path/to/myapp/build/production。如果这样做,则必须先清除浏览器缓存,然后才能正常工作(在 chrome 上:扳手->工具-开发者工具->本地存储->主机名->X(用于删除)。

【讨论】:

    【解决方案2】:

    构建过程在构建过程中创建缩小版本。在浏览器中启动它并检查错误控制台显示的内容。

    【讨论】:

      【解决方案3】:

      所以这真的很晚了,但看起来你还没有将你的问题标记为已回答,我只是花了几个小时试图弄清楚这一点,结果证明这一切都是因为Sencha Docs、用于下载的 Sencha SDK 工具和实际的 Sencha SDK 之间的差异。

      希望这会对某人有所帮助 -

      如果您的 SDK 是 2.1.0 或更高版本,则需要使用 Sencha Command 3.0.0(而不是适用于 Sencha 2.0 的 SDK 工具)启动基本应用程序。如果您让 Sencha Command 位正常工作(安装它并没有将它放在 PATH 中,所以我不得不手动添加它)一切都像一个魅力。

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

      希望能帮助一些落后者!

      【讨论】:

      • 会去看看!谢谢。
      猜你喜欢
      • 1970-01-01
      • 2014-10-11
      • 1970-01-01
      • 1970-01-01
      • 2012-08-18
      • 1970-01-01
      • 2014-05-25
      • 2014-06-02
      • 1970-01-01
      相关资源
      最近更新 更多