ios - Sencha Touch 未初始化

标签 ios ipad sencha-touch sencha-touch-2

我的 sencha touch 应用程序在所有浏览器中都运行良好,但是当我将 url 保存到 iPad 主屏幕时。它不会加载,只会显示一个空白屏幕。我没有收到任何 JS 错误,调试时日志中也没有任何内容。下面是应用示例:

script type="text/javascript">
    var rootPanel;
    if (navigator.userAgent.match(/iPad/i)) {
        viewport = document.querySelector("meta[name=viewport]");
        viewport.setAttribute('content', 'width=980');
    }
    Ext.application({
        launch: function () {



            var contactForm = Ext.create('Ext.form.FormPanel', {
                standardSubmit: true,
                fullscreen: true,
                items: [{
                    xtype: 'titlebar',
                    title: 'My App',
                    docked: 'top'
                }, {
                    xtype: 'fieldset',
                    items: [{
                        xtype: 'textfield',
                        name: 'LoginName',
                        label: 'Login Name:'
                    }, {
                        xtype: 'passwordfield',
                        name: 'Password',
                        label: 'Password:'
                    },
                    {
                        xtype: 'hiddenfield',
                        name: 'ReturnUrl',
                        value: '/returnUser.html'
                    }] // items
                }, {
                    xtype: 'toolbar',
                    layout: {
                        pack: 'center'
                    }, // layout
                    ui: 'plain',
                    items: [{
                        xtype: 'button',
                        text: 'Reset',
                        ui: 'decline',
                        handler: function (btn, evt) {
                            Ext.Msg.confirm('', 'Are you sure you want to reset this form?', function (btn) {
                                if (btn === 'yes') {
                                    contactForm.setValues({
                                        LoginName: '',
                                        Password: ''
                                    }); // contactForm()
                                } // switch
                            }); // confirm()
                        }
                    }, {
                        xtype: 'button',
                        text: 'Submit',
                        ui: 'confirm',
                        handler: function (btn, evt) {
                            var values = contactForm.getValues();

                            contactForm.submit({
                                url: 'Login',
                                method: 'POST',
                                waitTitle: 'Connecting',
                                waitMsg: 'Sending data...',
                                success: function (form, result) {
                                    Ext.Msg.alert('Login succeeded!', result.response.reason);
                                },
                                failure: function (form, result) {
                                    Ext.Msg.alert('Login Failed!', result.response.reason);
                                }
                            });

                        } // handler
                    }] // items (toolbar)
                }] // items (formpanel)
            }); // create()
        } // launch
    }); // application()


    $(document).ready(function () {

    });

我在 Ext.Application 的启动方法中放置了一个警告,但它没有显示。当我在 document.ready 函数中放置一个警报时,它确实显示了。我还应该注意到它确实在 ipad 浏览器上工作,只是在从主屏幕上的图标启动时不工作。

最佳答案

我在 android 中遇到了类似的问题,实际上在我的情况下,问题是因为没有启用 Ext.Loader 我看到你也没有包括它。在 Ext.application 之前包含此脚本并查看它是否有效

Ext.Loader.setConfig({
    enabled:true
});

Ext.application({...});

关于ios - Sencha Touch 未初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15115314/

相关文章:

xmlhttprequest - Safari 默默地将 200 个对 AJAX 请求的响应转换为 304s

ios - 如何在 Sencha Touch 2 上升级 Cordova

sencha-touch - 动态添加和删除商店石斑鱼

xcode - 命令/usr/bin/codesign失败,退出代码为1

objective-c - UITableViewCell 中的可编辑文本字段

iphone - Facebook 应用程序 URL 未转到正确的位置

iphone - 如何隐藏 mkmapview monotouch iPhone 的合法链接

ios - 查明两个日期之间是否已经过去了两个日历日

ios - Swift4:响应选择器不工作

css - iPad 输入按钮样式