iOS Question iEventKit - Select calendar

kohle

Active Member
Licensed User
Longtime User
How I select a calendar for saving an event . I have calendars : Work, Privat, Kits .
They a integrated from google and shown in the calendar app.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Add a global Map variable named Calendars.

2. Fill it after you get access to the store:
B4X:
Calendars.Initialize
Dim no As NativeObject = store
Dim Cals As List = no.GetField("store").RunMethod("calendarsForEntityType:", Array(0)) '0 = events, 1 = reminders
For Each Cal As NativeObject In Cals
   Calendars.Put(Cal.GetField("title"), Cal)
Next
Log(Calendars)

3. Set the calendar property when you create a new event:
B4X:
Dim ev As CalendarEvent = store.CreateEvent
ev.Title = "New Event"
Dim no As NativeObject = ev
no.SetField("calendar", Calendars.Get("Calendar")) 'The calendar name is Calendar in this case.
 
Upvote 0
Top