2012-08-09 36 views
-1

香港專業教育學院安裝了iOS日曆插件成功(我認爲)從這裏: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/CalendarPluginPhoneGap /科爾多瓦插件 - 如何設置?

不過,我只是不能似乎得到它的工作。 到目前爲止繼承人我做了什麼:

  1. 丟棄的日曆h和.m文件到我 項目的plugins文件夾。
  2. 添加了calendar.js文件到我的目錄結構和 鏈接的標題
  3. 添加了EventKit和EventKitUI框架,以我的項目
  4. 新增術語calendarPlugin我cordova.plist文件

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

您剛纔問這個問題? http://stackoverflow.com/questions/11876074/jquery-function-present-but-saying-method-undefined – ahren 2012-08-09 04:36:26

+0

你把它添加到你的cordova.plist文件中,在插件下? – Jeemusu 2012-08-09 04:37:02

+0

@ahren是的 - 我想我應該更具體。這似乎是一個PhoneGap的問題以及JavaScript問題 – MeltingDog 2012-08-09 04:40:09

回答

0

不要使用$(document).ready(function());.而是使用設備準備好。在body加載時調用onBodyLoad()函數。

function onBodyLoad() 
     {   
      document.addEventListener("deviceready", onDeviceReady, false); 
      deviceready = true; 
     } 

//////////////////////////////////

function onDeviceReady() 
    { 
     // Your code goes here 

    } 
+0

謝謝 - 但沒有運氣在我的結束:( – MeltingDog 2012-08-09 23:08:03

相關問題