omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    2
    3
    2741
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cvp
      cvp last edited by cvp

      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
      
      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • cvp
          cvp last edited by cvp

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors