1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Vote Rating
    1
    patrickgeiger is on a distinguished road

      0  

    Default Sencha Touch Build - Error

    Sencha Touch Build - Error


    Hi,

    I'm building a Sencha Touch app and deploying as a native app via PhoneGap. I'm using a PhoneGap plugin called "LowLatencyAudio". In development mode, the app runs great. However, when I try to produce a build via the Sencha command (sencha create jsb -a index.html -p app.jsb3), I get "Error thown from your application with message: TypeError: 'undefined' is not a function".

    I've narrowed the issue down to the LowLatencyAudio plugin. Is there something I missing to create a Sencha build that utilizes plugins?

    Thanks,
    Patrick




  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Are you including the JS for the Cordova plugin in app.json? is it *before* sencha-touch.js?

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Vote Rating
    1
    patrickgeiger is on a distinguished road

      0  

    Default


    Yes, I am doing that. If I comment-out the plug-in's cordova.exec function calls, it builds the jsb3 file perfectly fine. So the issue is related to the use of the phonegap plugin, not the cordova lib itself.

    Thanks,
    Patrick

  4. #4
    Sencha User siebmanb's Avatar
    Join Date
    Aug 2011
    Location
    Geneva (CH) - Grenoble (FR)
    Posts
    253
    Vote Rating
    15
    siebmanb will become famous soon enough

      0  

    Default


    This is because their should not be any "unprotected" Phonegap calls outside of the onDeviceReady function. The compilation script is trying to execute the code, and cannot make the Phonegap call. You have to protect it with something like this :


    Code:
    if (!window.plugins.LowLatencyAudio) return false;

    That way, the plugin cannot be called if it does not exist
    Twitter account @siebmanb.
    Co-founder & CEO at ButterflyEffect.
    Mobile application developer using Sencha Touch and Phonegap for iOS, Android and webapp.