2013-10-30 62 views
0

我有一个奇怪的行为。 我在xcode上运行我的sencha touch 2/phonegap 2.0应用程序4.3xcode不能识别sencha touch javascript语法

我的一些视图,其中只加载模拟器/设备。而它在浏览器上加载的很好。

我没有在日志中得到任何特殊错误,所以我开始在视图中删除项目。 终于,我发现XCODE有问题来识别一些xtype,如“fieldset”,“emailfield”,“passwordfield”等。 在将fieldset改为“container”并将字段添加到“textfield”我的视图被加载成功地。奇怪啊?

这一点在下面的代码:

/* 
* File: app/view/loginformpanel.js 
* 
* This file was generated by Sencha Architect version 2.2.2. 
* http://www.sencha.com/products/architect/ 
* 
* This file requires use of the Sencha Touch 2.1.x library, under independent license. 
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more 
* details see http://www.sencha.com/license or contact [email protected] 
* 
* This file will be auto-generated each and everytime you save your project. 
* 
* Do NOT hand edit this file. 
*/ 

Ext.define('MyApp.view.loginformpanel', { 
    extend: 'Ext.form.Panel', 

    config: { 
     baseCls: 'fbloginpanel', 
     id: 'loginformpanel', 
     itemId: 'loginformpanel', 
     layout: { 
      type: 'vbox' 
     }, 
     scrollable: { 
      direction: 'vertical' 
     }, 
     items: [ 
      { 
       xtype: 'container', 
       flex: 20, 
       cls: 'fblogin', 
       layout: { 
        type: 'vbox' 
       }, 
       items: [ 
        { 
         xtype: 'container', 
         flex: 3, 
         cls: 'wholepageRelative' 
        }, 
        { 
         xtype: 'container', 
         flex: 18, 
         cls: 'wholepageRelative', 
         layout: { 
          type: 'vbox' 
         }, 
         items: [ 
          { 
           xtype: 'container', 
           flex: 8, 
           docked: 'top', 
           layout: { 
            type: 'vbox' 
           }, 
           items: [ 
            { 
             xtype: 'fieldset', 
             flex: 2, 
             cls: 'loginmargin', 
             docked: 'top', 
             title: 'Existing User', 
             items: [ 
              { 
               xtype: 'emailfield', 
               id: 'email1', 
               itemId: 'email1', 
               name: 'email1', 
               placeHolder: 'Email' 
              }, 
              { 
               xtype: 'passwordfield', 
               id: 'password1', 
               itemId: 'password1', 
               name: 'password1', 
               placeHolder: 'Password' 
              } 
             ] 
            }, 
            { 
             xtype: 'button', 
             flex: 1, 
             cls: [ 
              'loginmargin', 
              'Signbutton' 
             ], 
             docked: 'bottom', 
             id: 'reglogin', 
             itemId: 'reglogin', 
             ui: 'round', 
             icon: '', 
             scope: this 
            } 
           ] 
          }, 
          { 
           xtype: 'container', 
           flex: 10, 
           layout: { 
            type: 'vbox' 
           }, 
           items: [ 
            { 
             xtype: 'container', 
             flex: 10, 
             layout: { 
              type: 'vbox' 
             }, 
             items: [ 
              { 
               xtype: 'fieldset', 
               flex: 4, 
               cls: 'loginmargin', 
               docked: 'top', 
               layout: { 
                type: 'vbox' 
               }, 
               title: 'New User', 
               items: [ 
                { 
                 xtype: 'textfield', 
                 id: 'username', 
                 itemId: 'username', 
                 name: 'username', 
                 placeHolder: 'Username' 
                }, 
                { 
                 xtype: 'passwordfield', 
                 id: 'password', 
                 itemId: 'password', 
                 name: 'password', 
                 placeHolder: 'Password' 
                }, 
                { 
                 xtype: 'emailfield', 
                 id: 'email', 
                 itemId: 'email', 
                 name: 'email', 
                 placeHolder: 'Email' 
                }, 
                { 
                 xtype: 'passwordfield', 
                 hidden: true, 
                 id: 'hashpassword', 
                 itemId: 'hashpassword', 
                 label: 'ססמא', 
                 name: 'hashpassword' 
                }, 
                { 
                 xtype: 'numberfield', 
                 hidden: true, 
                 label: 'Field', 
                 name: 'bfacebook' 
                }, 
                { 
                 xtype: 'numberfield', 
                 hidden: true, 
                 label: 'Field', 
                 name: 'bregister' 
                } 
               ] 
              }, 
              { 
               xtype: 'container', 
               flex: 4, 
               minHeight: 100, 
               layout: { 
                type: 'vbox' 
               }, 
               items: [ 
                { 
                 xtype: 'button', 
                 cls: [ 
                  'loginmargin', 
                  'Regbutton' 
                 ], 
                 docked: 'top', 
                 id: 'regbtn', 
                 itemId: 'regbtn', 
                 ui: 'round', 
                 icon: '', 
                 scope: this 
                }, 
                { 
                 xtype: 'button', 
                 cls: 'fbLoginbtn', 
                 docked: 'bottom', 
                 height: '', 
                 id: 'fbloginbtn1', 
                 itemId: 'fbloginbtn1', 
                 ui: '' 
                } 
               ] 
              }, 
              { 
               xtype: 'container', 
               flex: 2, 
               docked: 'bottom', 
               height: 50 
              } 
             ] 
            } 
           ] 
          } 
         ] 
        } 
       ] 
      }, 
      { 
       xtype: 'toolbar', 
       cls: 'registerToolbar', 
       docked: 'top', 
       items: [ 
        { 
         xtype: 'button', 
         baseCls: 'backbtn', 
         docked: 'left', 
         height: '', 
         id: 'loginbackbtn', 
         itemId: 'loginbackbtn', 
         width: '18%' 
        } 
       ] 
      } 
     ], 
     listeners: [ 
      { 
       fn: 'onLoginbackbtnTap', 
       event: 'tap', 
       delegate: '#loginbackbtn' 
      } 
     ] 
    }, 

    onLoginbackbtnTap: function(button, e, eOpts) { 
     //var Screen = Ext.ComponentQuery.query('#fbloginpanel'); 

     Ext.Viewport.setActiveItem(Ext.ComponentQuery.query('#fbloginpanel')[0]); 
     //Ext.Viewport.show(); 
    } 

}); 

现在我有其他的意见更多的问题,即使没有这些情况。

确实有人有类似的问题吗? 请帮助我。

回答

0

只是一个很快的猜测,但是您没有在您发布的课程中使用“requires”关键字。

您的视图完全有可能无法在模拟器或设备上加载,因为应用程序在构建后不知道如何解析这些xtypes,因为“开发”和“生产”模式非常不同。

作为一种最佳实践,请始终对您的课程使用的每个依赖项使用“requires”。

+0

谢谢。我正在使用建筑师。所以这是它生成的代码。在我的主App.js中,我看到了需求和路径,并要求EXT。库(是不是足够):Ext.Loader.setConfig({ disableCaching:假, 路径:{ 分机: '触摸/ SRC', 'Ext.device': '设备', “MyApp.Facebook ':'app /' } }); Ext.application({ 要求:[ 'Ext.device.Geolocation', 'Ext.device.Notification', 'Ext.TitleBar', , “分机 'Ext.data *'。 device.Connection' ], – user2427457

+0

在每个视图中都有一个用于“requires”的配置 - 当您编译/构建应用程序时这是必需的,这样可以将依赖关系捆绑在一起 – arthurakay

+0

谢谢,实际情况是这样,但我放只需要在app.js中,它已经足够了,再次感谢。Eli。(PS不知道为什么它不需要在Android中?) – user2427457