【发布时间】:2014-03-06 09:40:09
【问题描述】:
我们已经在 phonegap 环境中开发了 iPhone 应用程序。我想在 Objective-C Xcode 中调用下面的 javascritpt 函数来在原生 iOS 日历中创建一个事件。
//calendar.js
var calendarPlugin = {
createEvent: function(title, location, notes, startDate, endDate, successCallback, errorCallback) {
cordova.exec(
successCallback, // success callback function
errorCallback, // error callback function
'CalendarPlugin', // mapped to our native Java class called "CalendarPlugin"
'addCalendarEntry', // with this action name
[{ // and this array of custom arguments to create our entry
"title": title,
"description": notes,
"eventLocation": location,
"startTimeMillis": startDate.getTime(),
"endTimeMillis": endDate.getTime()
}]
);
}
}
我有Objective C中日历事件的基本代码,我只需要将字符串值从javascript传递给这个日历事件Obj-c方法。在下面的 webview 方法中写什么
- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
【问题讨论】:
-
我有一些有用的解决方案链接。 github.com/felixactv8/Phonegap-Calendar-Plugin-ios
标签: javascript objective-c cordova