Cannot-call-method substring of undefined sencha-touch-all.js
来源:互联网 发布:燃烧的法庭 知乎 编辑:程序博客网 时间:2024/06/06 00:35
今天写sencha touch页面跳转时遇到了这个bug,怎么找都找不到错误
先贴出错误代码
Ext.define("NotesApp.view.View1", { extend: "Ext.Container", // alias: "widget.view1", config:{ id:'view1', layout: { type:'fit' }, items: { xtype: "button", text:"第一页", centered: true, iconMask: true, itemId: "FirstButton" }, listeners: { delegate: "#FirstButton", event: "tap", fn: "onFirstButtonHandler" }}, onFirstButtonHandler: function () { console.log("enter onNewNoteHandler"); this.fireEvent("FirstEvent", this); }});
下面是app.js里的调用
function onDeviceReady(){ console.log("device ready2"); Ext.application({ name: "NotesApp", controllers: ["myController"], views: ["View1", "View2"], launch: function () { var View1 = { xtype: "view1" }; var View2 = { xtype: "view2" }; Ext.Viewport.add([View1, View2]); console.log("quit onNewNoteHandler"); }});}
虽然应用能加载,但出来的全是白屏
google后在一个帖子里发现了这么一句话:
Because the code is not checking that an object is undefined before calling the .substring method on it.
大致是你引用了一个对象或类却没有声明,
首先是看看标示符有没有拼错,或者方法名有没有拼错
发现了一个地方拼错了,然后还不行,
回头去翻《深入浅出phonegap》的有关部分,发现了下面一句
原因是没有添加
alias: "widget.view1",
这句话,导致在app.js里产生了未知引用,报出上面的错误。
————————————————————————
此外还有一个错误,是跟这个一起出现的
Unknown chromium error: -6
这个bug会出现在你写了不存在的标示符的时候出现,比如把view1写成view2。
——————————————————
sencha touch的页面跳转至今还没搞定,努力中……….
0 0
- Cannot-call-method substring of undefined sencha-touch-all.js
- Uncaught TypeError: Cannot call method 'substring' of undefined
- Extjs4---Uncaught TypeError: Cannot call method 'substring' of undefined
- Uncaught TypeError: Cannot call method 'substring' of undefined
- Uncaught TypeError: Cannot call method 'substring' of undefined
- Cannot call method 'indexOf' of undefined
- cannot call method foreach of undefined问题
- sencha touch报错 Cannot read property 'apply' of undefined
- Extjs4---Uncaught TypeError: Cannot call method 'apply' of undefined
- Extjs4---Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined
- Uncaught TypeError: Cannot call method 'replace' of undefined 的解决
- Extjs4---Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined
- jQuery UI Slider - Cannot call method 'addClass' of undefined
- JsBridge "Uncaught TypeError: Cannot call method 'callHandler' of undefined", source
- 关于js页面:cannot read property 'call' of undefined
- jquery file upload报错:Uncaught TypeError: Cannot call method 'unshift' of undefined
- jquery file upload报错:Cannot call method 'parseMetaData' of undefined
- TypeError:Cannot call method 'getItem' of null
- 引导程序和操作系统的区别
- Matlab资料汇总暨MATLAB中文论坛帖子整理(三)
- 【Qt---->creator】mainwindow.ui does not exist
- WordPress大三寒假总结
- Java笔记----5. 面向对象(封装、继承、多态)
- Cannot-call-method substring of undefined sencha-touch-all.js
- [linux学习笔记] GCC环境安装问题
- C++编译链接过程
- 安卓开发如何修改应用名称
- 操作系统启动过程
- fragment的静态加载
- JAVA中的堆栈问题以及String和new String
- IBM 总架构师:话说程序员的职业生涯
- 解决:UiView 中没有控制背景的API