-
7 Mar 2012 2:50 AM #1
PhoneGap: TypeError: 'undefined' is not a function
PhoneGap: TypeError: 'undefined' is not a function
Hi
I'm trying to wrap my Sencha Touch 2 app into a phonegap application. I'm new to xcode/phonegap development, but the only think I found on the web to get a little bit of debug info is to add the following to your index.html file
So, the error I got wasCode:<script>window.onerror = function(error) { console.error(error); alert(error); };</script>
I found that changing autoMaximize to false solved this errorCode:2012-03-07 11:38:06.373 barebones-phonegap[30838:13403] [INFO] Error: [ERROR][Ext.viewport.Ios#undefined] Timeout waiting for window.innerHeight to change
However now I get the following errorCode:viewport : { autoMaximize : false },
Not very helpful. So how to debug javascript in xcode, I couldn't find much helpful info on the web.Code:2012-03-07 11:45:38.425 barebones-phonegap[30917:13403] [INFO] TypeError: 'undefined' is not a function
Any suggestions ?
Furthermore, I found this link in which a UIWebView is suggested. Will this work ? Sounds like a very simple solution!!
Cheers
Luca
Update: I've managed to get the main view (which is initially shown) to work. It show a list (items are loaded using a store). Anyway, if I click on a item/button I get the 'undefined is not a function' error, always!!
UPDATE 2: I got it working
If I remove the cordova-1.5.0.js file it works. I do get erros now 'variable cordova does not exist but if I remove the window.onerror line it works like a charm. Here is the index.html
So this should be something in ST I guess!?Code:<!DOCTYPE html><html> <head> <title></title> <!-- <script>window.onerror = function(error) { console.error(error); alert(error); };</script> --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> <meta charset="utf-8"> <!-- <script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script> --> <link rel="stylesheet" href="generated/css/myapp.css" type="text/css"> <script type="text/javascript" src="generated/js/app-all.js"></script> <script type="text/javascript" src="app/MyApp.js"></script> </head> <body></body> </html>
-
7 Mar 2012 5:49 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
So it works just fine when you removed cordova?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Mar 2012 6:09 AM #3
yes. Without cordova I can use the app without problems. With cordova included the app starts normally, but when you try to interact with the app the 'undefined is not a function' error occurs with every mouse click (I'm testing in the xcode iphone simulator)
-
7 Mar 2012 6:11 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
Ok, sounds like cordova is placing a listener that is conflicting.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Mar 2012 6:37 AM #5
-
8 Mar 2012 9:54 AM #6


Reply With Quote