0

ネイティブの EmailComposer を統合しているときに phonegap で問題に直面しています。

MailComposer はボタンをクリックすると開くはずですが、IOS の mailComposer は表示されません。Android の同じコードが機能しています。

私のコードは次のとおりです。

        <html>
        <head>
            <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
            <script type="text/javascript" charset="utf-8" src="emailcomposer.js"></script>

            <script type="text/javascript">
            document.addEventListener("deviceready", deviceready, true);
            function deviceready() {
                console.log("Device ready");
            }.
            //function to send mail using mail composer
            function composeText(){
var vehiclemileage = document.getElementById('vehiclemileage').value;
var vehiclemodel = document.getElementById('vehiclemodel').value;
var message1 = document.getElementById('message_body').value;
var vechicleyear = document.getElementById("yeardropdown");
var strUser = vechicleyear.options[vechicleyear.selectedIndex].value;
var vehiclemake = document.getElementById("vehiclemake");
var makevehicle = vehiclemake.options[vehiclemake.selectedIndex].value;

var deviceName = device.platform;
var devicemodel = device.model;


if(vehiclemodel == '' || makevehicle == ''){
alert("Please Enter all the Value");

 navigator.notification.alert(
        'Please Enter all the Value', // message
        alertDismissed,              // callback
        'Vehicle and Model',        // title
        'Ok'                       // buttonName
    );
 }
else
{
            //function to check folder named "RepairMyCar" and extract picture from folder to attach it to mail
                var attachPath; 
                var attachFile= new Array();
                window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
                    fileSystem.root.getDirectory("RepairMyCar", {
                        create: true
                    }, 
        function(directory) {
            console.log("Final 63" + directory.fullPath);
            attachPaths = directory.fullPath;
            var attachPath=attachPaths.slice(7,attachPaths.length);
            var directoryReader = directory.createReader();
            directoryReader.readEntries(function(entries) {
                var i;
                for (i=0; i<entries.length; i++) {
                    console.log(entries[i].name);
attachFile[i] =attachPath + "/" + entries[i].name;
                            }
                            console.log(attachFile);
                        }, 
                        function (error) {
                            alert(error.code);
                        });

                    });
                }, function(error) {
                    alert("can't even get the file system: " + error.code);
                });
                var dated, fnamed, phoned, emailed;
                 if(typeof(Storage)!=="undefined")
{
 dated = localStorage.date;
 fnamed = localStorage.fname;
 phoned = localStorage.phone;
 emailed= localStorage.email;
}

                console.log(attachFile);
                var newattachment = attachFile.toString();
                //Open mail composer with all datas
 setTimeout(function(){window.plugins.emailComposer.showEmailComposerWithCallback(null,
                    "Get an Estimate",
                     "Date: " + dated + '<br>' + "First Name: " + fnamed +  '<br>' + "Phone Number: " + phoned +  '<br>' + "Email Address: " + emailed +   '<br>' + "Year of Vehicle: " + strUser +  '<br>' + "Make of Vehicle: " + makevehicle +  '<br>' +  "Model of Vehicle: " + " " + vehiclemodel + '<br>' + 
                     "Mileage of Vehicle: " + " " + vehiclemileage + '<br>' +  message1 + '<br>' + "Sent from My:" + deviceName + devicemodel,
                [sth@sth.com],
                    [],
                    [],
                    true,
                    attachFile
                    );},100);
                //Clear LoccalStorage
                localStorage.clear();
            //exit the app after clicking this button
            navigator.app.exitApp();
            // navigator.camera.cleanup(onSuccess,fail);
            // function onSuccess(){
            // }
            // function fail(){
            // }
        }
}
        function onFail(message) {
            alert('Failed because: ' + message);
        }

    /***********************************************
    * Drop Down Date select script- by JavaScriptKit.com
    * This notice MUST stay intact for use
    * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
    ***********************************************/
    //function to  load year in drodown. Default selected year : Current Year
    function populatedropdown(yearfield){
        var today=new Date()
        var yearfield=document.getElementById(yearfield)
        for (var i=0; i<31; i++)
            //Select Year
    var thisyear=today.getFullYear()
    for (var y=0; y<25; y++){
        yearfield.options[y]=new Option(thisyear, thisyear)
        thisyear-=1
    }
    yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
    }
    </script>

    </head>
    <body>
        <div class="wrapper">
            <h1>Get a Repair Estimate</h1>
            <div class="main-content">
    <p>
                Please Enter the Year, Make, Model and Mileage of Your Vehicle and any other information we should know.
                </p>
                <form class="vehicle-detail-form">
                <ul>
                    <li>
                        <label>Year of Vehicle: </label>
                        <form action="" name="someform">
                        <select id="yeardropdown">
                        </select> 
                    </form>

                    <script type="text/javascript">

    //populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select)
    window.onload=function(){
        populatedropdown("yeardropdown")
    }
    </script>
                    </li>
                    <!-- Vehicle Year Selection -->

    <li><label>Model of Vehicle:</label>
    <input type="text" name="vehiclemodel" id = "vehiclemodel">
    </li>
    <li><label>Mileage of Vehicle:</label>
    <input type="number" name="vehiclemileage" id = "vehiclemileage"></li>
    <li>
        <textarea  name="message_body" id = 'message_body'  placeholder="Add Notes here(if any)"></textarea>
    </li>
    </form>
    <div style="clear:both;"></div>
    <div class="large-button-wrapper">
    <button onclick="composeText();">Get Your Estimate</button>
    </div>  
    </div>
    </div>
    </body>
    </html>

このリンクに記載されているように、プラグインフォルダーに EmailComposer.h と EmailComposer.m を保持しました

4

1 に答える 1

1

iOS プロジェクトで作業している場合の回避策を見つけました。同じ問題があります。

バックボーン ルーターでのビューの変更がconsole.logXcode で機能しなくなったら、Mac で Safari Web Inspector を使用できます。すべてconsole.logがそこに見えます。

于 2013-12-10T13:48:23.483 に答える