0

In macOS/Cocoa, is there a way to use EventKit to open the Calendar.app at a specific date/time?

I use NSWorkspace.sharedWorkspace().launchAppWithBundleIdentifier("com.apple.iCal", options: .Default, additionalEventParamDescriptor: nil, launchIdentifier: nil) to open the app, which works.

In an unsandboxed environment I could use a Scripting Bridge object and do:

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

But with sandboxing on, I cannot find a way. EventKit has this user-permission layer, so I thought it a likely candidate to use instead of SB.

kb920
  • 3,039
  • 2
  • 33
  • 44
Alex
  • 631
  • 1
  • 8
  • 33

1 Answers1

0

I would do it with an AppleScript like

tell application "Calendar"
    view calendar at current date
end tell

There are ways how you could run an AppleScript in a sandboxed app.

Marc T.
  • 5,090
  • 1
  • 23
  • 40