使用EventKit在特定日期打开Calendar.app

时间:2016-10-06 11:44:20

标签: objective-c swift macos cocoa eventkit

在macOS / Cocoa中,有没有办法在特定日期/时间使用EventKit打开Calendar.app?

我使用NSWorkspace.sharedWorkspace().launchAppWithBundleIdentifier("com.apple.iCal", options: .Default, additionalEventParamDescriptor: nil, launchIdentifier: nil)打开可以运行的应用。

在unsandboxbox环境中,我可以使用Scripting Bridge对象并执行:

let calendarApp = SBApplication(bundleIdentifier: "com.apple.iCal") as! CalendarApplication
if let date = todoItem.properties["icalEventStart"] {
    calendarApp.viewCalendarAt!(date as! NSDate)
}

但是随着沙盒的开启,我找不到办法。 EventKit有这个用户权限层,所以我认为它可能是使用而不是SB。

0 个答案:

没有答案
相关问题