1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default 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

    Code:
     <script>window.onerror = function(error) { console.error(error); alert(error); };</script>
    So, the error I got was

    Code:
    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
    I found that changing autoMaximize to false solved this error

    Code:
    viewport : {                
        autoMaximize : false
    },
    However now I get the following error

    Code:
    2012-03-07 11:45:38.425 barebones-phonegap[30917:13403] [INFO] TypeError: 'undefined' is not a function
    Not very helpful. So how to debug javascript in xcode, I couldn't find much helpful info on the web.
    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

    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>
    So this should be something in ST I guess!?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,780
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So it works just fine when you removed cordova?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default


    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)

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,780
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Ok, sounds like cordova is placing a listener that is conflicting.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Posts
    139
    Vote Rating
    3
    jeanluca is on a distinguished road

      0  

    Default


    ok, what does that mean for now ?

  6. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    16
    Vote Rating
    0
    crankin is on a distinguished road

      0  

    Default


    s

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi