blackberry.pim.calendar不适合我

时间:2013-04-01 08:06:59

标签: blackberry-webworks blackberry-10

我刚刚开始为BB10编写应用程序,并使用calendarEvent对象。

function createEvents(location, summary, startTime, endTime, frequency, dayInWeek, expires) {

var testing = blackberry.pim.calendar;
document.write("<p>My First app</p>");

var evt,
calendar = blackberry.pim.calendar,
CalendarRepeatRule = calendar.CalendarRepeatRule;
var start = new Date(startTime);
var end = new Date(endTime);
var location = location;
var summary = summary;
.
.
.
}

我在涟漪中运行它,但是当我运行此功能时它甚至不会打印出“我的第一个应用程序”。 在我的config.xml中我有

被困了几个小时,任何帮助都将不胜感激!

1 个答案:

答案 0 :(得分:1)

Ripple不支持blackberry.pim.calendar API: https://developer.blackberry.com/html5/apis/blackberry.pim.calendar.html

我怀疑在createEvents中设置 testing 变量时会发生运行时错误。打开Web检查器进行确认。

建议进行特征检测以确保您将要使用的对象可用。

    function createEvents(location, summary, startTime, endTime, frequency, dayInWeek, expires) {

   if (window.blackberry && blackberry.pim) {
      var testing = blackberry.pim.calendar;
      document.write("<p>My First app</p>");

      var evt,
         calendar = blackberry.pim.calendar,
         CalendarRepeatRule = calendar.CalendarRepeatRule;
      var start = new Date(startTime);
      var end = new Date(endTime);
      var location = location;
      var summary = summary;
   } else {
      alert("blackberry.pim is not supported");
   }
.
.
.
}