PDA

View Full Version : Sencha Touch Build - Error



patrickgeiger
9 Oct 2012, 7:58 AM
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

jay@moduscreate.com
9 Oct 2012, 10:49 AM
Are you including the JS for the Cordova plugin in app.json? is it *before* sencha-touch.js?

patrickgeiger
9 Oct 2012, 10:52 AM
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

siebmanb
5 Nov 2012, 8:33 AM
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 :



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


That way, the plugin cannot be called if it does not exist B)