我从这里成功安装了iOS插件(我认为): https://github.com/phonegap/phonegap-plugins/tree/master/iOS/CalendarPlugin
然而,我似乎无法让它发挥作用。 到目前为止,我所做的是:
并且5.将以下代码添加到我要保存的页面中:
window.plugins.calendarPlugin.prototype.createEvent = function(title,location,notes, startDate, endDate){
var title= "My Appt";
var location = "Los Felix";
var notes = "me testing";
var startDate = "2012-11-23 09:30:00";
var endDate = "2012-11-23 12:30:00";
cal.createEvent(title,location,notes,startDate,endDate);
}
$(document).ready(function() {
cal = window.plugins.calendarPlugin;
var cal;
$('.calinfo').live('click', function() {
var desiredValue = $(this).parent().prev().find('.calendar').val();
console.log(desiredValue);
var calInfo = desiredValue.split(',');
createEvent(calInfo[0], calInfo[1], calInfo[2], calInfo[3], calInfo[4]);
});
});
当我跑步时,注意到了。我错过了什么吗?
答案 0 :(得分:0)
不要使用$(document).ready(function());.而是准备使用设备。在body load上调用函数onBodyLoad()。
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
deviceready = true;
}
//////////////////////////////////
function onDeviceReady()
{
// Your code goes here
}