katzer / cordova-plugin-email-composer

Edit and send email messages
Apache License 2.0
343 stars 333 forks source link

plugin throws errors on cordova/phongap 3.1 #4

Closed manorius closed 10 years ago

manorius commented 11 years ago

Hi,

I've installed the plugin on cordova 3.1 and I'm getting the following 2 errors whenever I'm trying to use it.

When I load the app to my android device: 11-08 15:47:25.689: E/Web Console(29177): Uncaught ReferenceError: module is not defined at file:///android_asset/www/js/email_composer.js:51

When I invoke window.plugin.email.open 11-08 15:54:07.348: E/Web Console(29177): Uncaught TypeError: Converting circular structure to JSON at file:///android_asset/www/cordova.js:901

Any help is highly appreciated. Thanks

katzer commented 11 years ago

Hello,

sounds like email_composer.js is loaded before cordova.js.

manorius commented 11 years ago

That's weird... because I'm loading the cordova plugin first and then the email_composer.js script

    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="js/jquery.touchSwipe.min.js"></script>
    <script type="text/javascript" src="js/jquery.tap.min.js"></script>
    <script type="text/javascript" src="js/color-thief.js"></script>
    <script type="text/javascript" src="js/mustache.js"></script>
    <script type="text/javascript" src="js/templates.js"></script>
    <script type="text/javascript" src="js/email_composer.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
katzer commented 11 years ago

Usually there is no need to load the plugins by self. cordova.js loads cordova_plugins.jswhere all plugins and meta informations are listed. If cordova is ready and the moduleobject is present, it will load all plugins.

manorius commented 10 years ago

Even if I remove the email_composer.js script I get the bellow errors:

11-15 11:31:23.093: I/chromium(3704): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported 11-15 11:31:23.133: I/chromium(3704): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported 11-15 11:31:26.253: I/chromium(3704): [INFO:CONSOLE(1031)] "processMessage failed: Message: S01 EmailComposer1237384004 t", source: file:///android_asset/www/cordova.js (1031) 11-15 11:31:26.253: I/chromium(3704): [INFO:CONSOLE(1032)] "processMessage failed: Error: ReferenceError: isavailable is not defined", source: file:///android_asset/www/cordova.js (1032) 11-15 11:31:26.253: I/chromium(3704): [INFO:CONSOLE(1033)] "processMessage failed: Stack: ReferenceError: isavailable is not defined 11-15 11:31:26.253: I/chromium(3704): at file:///android_asset/www/js/index.js:59:15 11-15 11:31:26.253: I/chromium(3704): at callbackFn (file:///android_asset/www/plugins/de.appplant.cordova.plugin.email-composer/www/email_composer.js:41:13) 11-15 11:31:26.253: I/chromium(3704): at Object.cordova.callbackFromNative (file:///android_asset/www/cordova.js:289:54) 11-15 11:31:26.253: I/chromium(3704): at processMessage (file:///android_asset/www/cordova.js:1026:21) 11-15 11:31:26.253: I/chromium(3704): at Function.androidExec.processMessages (file:///android_asset/www/cordova.js:1060:13) 11-15 11:31:26.253: I/chromium(3704): at Object.androidExec as exec 11-15 11:31:26.253: I/chromium(3704): at Object.EmailComposer.isServiceAvailable (file:///android_asset/www/plugins/de.appplant.cordova.plugin.email-composer/www/email_composer.js:44:14) 11-15 11:31:26.253: I/chromium(3704): at HTMLImageElement.app.takePicture (file:///android_asset/www/js/index.js:57:29) 11-15 11:31:26.253: I/chromium(3704): at HTMLDivElement.b.event.dispatch (file:///android_asset/www/js/jquery-1.9.1.min.js:3:28337) 11-15 11:31:26.253: I/chromium(3704): at HTMLDivElement.v.handle (file:///android_asset/www/js/jquery-1.9.1.min.js:3:25042)", source: file:///android_asset/www/cordova.js (1033)

katzer commented 10 years ago

Are you sure that you have removed the email_composer.js? Because the script is part of the stack?

11-15 11:31:26.253: I/chromium(3704): at callbackFn (file:///android_asset/www/plugins/de.appplant.cordova.plugin.email-composer/www/_email_composer.js_:41:13)

The stack looks like that you try to reference the variable isavailable in your callback function, which is not defined.

11-15 11:31:26.253: I/chromium(3704): [INFO:CONSOLE(1033)] "processMessage failed: Stack: ReferenceError: _isavailable_ is not defined 11-15 11:31:26.253: I/chromium(3704): at file:///android_asset/www/js/index.js:59:15

jamesone commented 8 years ago

I had this same problem. All I had to do was include the following in my root www index.html: `

` Now you may not have these files in your ROOT WWW, but when you build the application, node will attach the correct files to the platform your using.