Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Try to add an event into standard Calendar
-
I try this short code but I get an error "no method found.......saveEvent", with or without the underscore.
Thanks to help me# coding: utf-8 from objc_util import * #import threading # EKEventStore = calendar database store = ObjCClass('EKEventStore').alloc().init() # Pythonista has authorization to access calendar, thus code is commented #access_granted = threading.Event() #def completion(_self, granted, _error): # access_granted.set() #completion_block = ObjCBlock(completion, argtypes=[c_void_p, c_bool, c_void_p]) #store.requestAccessToEntityType_completion_(0, completion_block) #access_granted.wait() event = ObjCClass('EKEvent').eventWithEventStore_(store) event.title = 'test' event.startDate = ObjCClass('NSDate').date() event.endDate = ObjCClass('NSDate').date() event.setCalendar_(store.defaultCalendarForNewEvents()) #event.alarms = ... store.saveEvent_(event,0) # only this instance
-
The method should be
saveEvent_span_error_()
. The span parameter is only relevant for recurring events, I think. You can probably pass 0 for that. -
Thanks a lot, it's ok now.
I think I had not read correctly the Apple documentation, sorry, shame on me.
My final challenge is to be able to set an alarm on an event, like "x minutes after the beginning of the event". This is allowed on Mac but not on the different apps I know on IOS, like the standard one and Calendar of Readdle.
I use that as "x minutes before the end of the event" to get, for instance, an alarm when I've to go get my little son, 15 minutes before the end of his tennis course.
Ok, that'll be for another day.
Still a lot of thanks for your marvelous app.