Javascript PhoneGap日历插件iOS无响应

Javascript PhoneGap日历插件iOS无响应,javascript,ios,cordova,calendar,Javascript,Ios,Cordova,Calendar,它接收输入,但不会在手机的本机日历中生成事件 我使用X代码在mac上运行PhoneGap构建 我只需要知道如何使用PhoneGap将javascript连接到iOS上的本机日历 任何帮助都会很棒 试试这个 确保您已经在config.xml中定义了插件 <div class="jumbotron"> <h1>Set Up Appointment</h1> <form action="" id="input" method="get" na

它接收输入,但不会在手机的本机日历中生成事件

我使用X代码在mac上运行PhoneGap构建

我只需要知道如何使用PhoneGap将javascript连接到iOS上的本机日历

任何帮助都会很棒

试试这个

确保您已经在config.xml中定义了插件

<div class="jumbotron">
    <h1>Set Up Appointment</h1>

    <form action="" id="input" method="get" name="input">
        document.addEventListener('deviceready', function(){ var cal; cal =
        window.plugins.calendarPlugin; $('#submit').click(function() { function
        createEvent(title,location,notes, startDate, endDate){ var title =
        document.getElementById=("name"); var notes =
        document.getElementById=("location"); var startDate =
        document.getElementById=("startDate"); var endDate =
        document.getElementById=("endDate");
        cal.createEvent(title,location,notes,startDate,endDate); } }); },
        false);<a href="https://www.nycm.com/Default.asp" target=
        "blank"><img src=
        "http://www.nycm.com/apcd/images/LogoTitle.gif"></a><br>

        <div class="inputTable" style="width:300px">
            <table>
                <tr>
                    <td>Name</td>

                    <td><input id="name" type="text"></td>
                </tr>

                <tr>
                    <td>Location</td>

                    <td><input id="location" type="text"></td>
                </tr>

                <tr>
                    <td>Start Date</td>

                    <td><input id="startDate" type="date"></td>
                </tr>

                <tr>
                    <td>End Date</td>

                    <td><input id="endDate" type="date"></td>
                </tr>

                <tr>
                    <td>Additional Info</td>

                    <td><input id="notes" type="text"></td>
                </tr>
            </table>

            <div class="submitButton">
                <input id="submit" type="submit" value="Submit">
            </div>
        </div><br>
    </form>
</div>
从JavaScript调用插件

#import "CustomPlugin.h"

    @implementation CustomPlugin

    - (void)sayHello:(CDVInvokedUrlCommand*)command{

        NSString *responseString =
            [NSString stringWithFormat:@"Hello World, %@", [command.arguments objectAtIndex:0]];

        CDVPluginResult *pluginResult =
            [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:responseString];

        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    }

    @end

我应该把自定义插件放在哪里?顺便说一下,非常感谢。您可以参考此文档,
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>

@interface CustomPlugin : CDVPlugin

- (void)sayHello:(CDVInvokedUrlCommand*)command;

@end
#import "CustomPlugin.h"

    @implementation CustomPlugin

    - (void)sayHello:(CDVInvokedUrlCommand*)command{

        NSString *responseString =
            [NSString stringWithFormat:@"Hello World, %@", [command.arguments objectAtIndex:0]];

        CDVPluginResult *pluginResult =
            [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:responseString];

        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    }

    @end
function initial(){
    var name = $("#NameInput").val();
    cordova.exec(sayHelloSuccess, sayHelloFailure, "CustomPlugin", "sayHello", [name]);
}

function sayHelloSuccess(data){
    alert("OK: " + data);
}

function sayHelloFailure(data){
    alert("FAIL: " + data);
}