*** -[BAGenericObjectNoDeleteOSAID moveEventID:toCalID:ofType:]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x7fd2b94d9e00: OSAID(1) ComponentInstance(0x8d0003)>
my moveEventID:"30B44E1A-8468-4193-88AB-CD508AF0CDF0" toCalID:"6674D9DA-44A2-4012-A704-FBFEE1EF2133" ofType:1
on moveEventID:eventID toCal:calName ofType:calType -- Cal type: Local = 0, CalDAV/iCloud = 1, Exchange = 2, Subscription = 3, Birthday = 4
-- create event store and get the OK to access Calendars
set theEKEventStore to current application's EKEventStore's alloc()'s init()
theEKEventStore's requestAccessToEntityType:0 completion:(missing value)
-- check if app has access; this will still occur the first time you OK authorization
set authorizationStatus to current application's EKEventStore's authorizationStatusForEntityType:0 -- work around enum bug
if authorizationStatus is not 3 then
display dialog "Access must be given in System Preferences" & linefeed & "-> Security & Privacy first." buttons {"OK"} default button 1
tell application "System Preferences"
activate
tell pane id "com.apple.preference.security" to reveal anchor "Privacy"
end tell
error number -128
end if
-- get calendars that can store events
set theCalendars to theEKEventStore's calendarsForEntityType:0
-- get the calendar
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title == %@ AND type == %@", calName, calType)
set theCalendar to item 1 of (theCalendars's filteredArrayUsingPredicate:theNSPredicate)
set TheEvent to (theEKEventStore's calendarItemsWithExternalIdentifier:eventID)'s firstObject()
TheEvent's setCalendar:theCalendar
set {theResult, theError} to theEKEventStore's saveEvent:TheEvent span:((current application's EKSpanThisEvent) + (current application's EKSpanFutureEvents as integer)) commit:true |error|:(reference)
if not theResult as boolean then error (theError's localizedDescription() as text)
end moveEventID:toCal:ofType: