EventKit

RSS for tag

Create, view, and edit calendar and reminder events using EventKit and EventKitUI. Request read-only, write-only, or full-access to Calendar data.

Posts under EventKit tag

147 Posts

Post

Replies

Boosts

Views

Activity

EKReminder URL property is nil
Quick question... how do I set the URL of a reminder? In the Reminders app, user can add a URL when they create a reminder.There's also a "url" property in EKCalendarItem (parent class of EKReminder).However, "url" is always nil both when I set it or when I read it from an existing reminder which contains a URL.Is this a bug?ThanksBill
4
2
2.1k
Dec ’22
Add multiple events to the Calendar with Concurrency
I created a function to add my course events to the calendar app using EventKit. After learning the swift concurrency, I want to update my code to make the progress much faster, namely using the detached task or TaskGroup to add these events. Synchronize code without detached task or task group: func export_test() { Task.detached { for i in 0...15 { print("Task \(i): Start") let courseEvent = EKEvent(eventStore: eventStore) courseEvent.title = "TEST" courseEvent.location = "TEST LOC" courseEvent.startDate = .now courseEvent.endDate = .now.addingTimeInterval(3600) courseEvent.calendar = eventStore.defaultCalendarForNewEvents courseEvent.addRecurrenceRule(EKRecurrenceRule(recurrenceWith: .daily, interval: 1, end: nil)) do { try eventStore.save(courseEvent, span: .futureEvents) } catch { print(error.localizedDescription) } print("Task \(i): Finished") } } } Doing the same thing using the TaskGroup : func export_test() { Task.detached { await withTaskGroup(of: Void.self) { group in for i in 0...15 { group.addTask { print("Task \(i): Start") let courseEvent = EKEvent(eventStore: eventStore) courseEvent.title = "TEST" courseEvent.location = "TEST LOC" courseEvent.startDate = .now courseEvent.endDate = .now.addingTimeInterval(3600) courseEvent.calendar = eventStore.defaultCalendarForNewEvents courseEvent.addRecurrenceRule(EKRecurrenceRule(recurrenceWith: .daily, interval: 1, end: nil)) do { try eventStore.save(courseEvent, span: .futureEvents) } catch { print(error.localizedDescription) } print("Task \(i): Finished") } } } } } The output of the TaskGroup version: Task 0: Start Task 1: Start Task 2: Start Task 4: Start Task 3: Start Task 5: Start Task 6: Start Task 7: Start Task 0: Finished Task 8: Start Task 1: Finished Task 9: Start Sometimes, only a few tasks will been done, and others will not, or even never been started (I created 16 tasks but only printed 9 in this example). Sometimes, all of these events can be added. In my point of view, I have created 16 child tasks in the TaskGroup. Each child task will add one event to the Calendar. I think in this way, I can take the full advantage of the multi-core performance (maybe it's actually not. 🙃) If I put the for-loop inside the group.addTask closure, it will always have the expected result, but in this way, we only have a single loop so the TaskGroup may no longer needed. I'm really exhausted🙃🙃.
1
0
1.8k
Dec ’22
Trying to Update Calendar, Getting Various Errors
I can add a new calendar to the user's calendars like this, using the saveCalendar(_:commit:) method: let ekStore = EKEventStore() func saveCalendar(calendar: EKCalendar) throws {     try ekStore.saveCalendar(calendar, commit: true) } let newList = EKCalendar(for: .reminder, eventStore: store.ekStore) newList.source = store.ekStore.defaultCalendarForNewReminders()?.source newList.title = newListName newList.cgColor = listColor do {     try saveCalendar(calendar: newList) } catch {     print("Error adding list: \(error.localizedDescription)") } And I store the calendar object. When the user finishes editing a calendar (reminders list) in my app, I try to save it like this, using the stored calendar as a starting point: let updatedList = existingCalendar updatedList.title = newListName updatedList.cgColor = listColor do {     try saveCalendar(calendar: updatedList) } catch {     print("Error saving list: \(error.localizedDescription)") } But the calendar doesn't save and I get this error: That account does not support reminders.. I have also tried explicitly setting the calendar's source: updatedList.source = store.ekStore.defaultCalendarForNewReminders()?.source but then I get this error: That calendar may not be moved to another account.. My Question: How do I update calendars (reminder lists) from my app?
0
0
1.4k
Dec ’22
Since iOS 16.1, my widget started to not work properly. Seems like a bug. Can't access Calendar / reminder
My widget app was working fine before iOS 16.1. Since upgrading to 16.1 (and 16.1.1) my widgets starts to be buggy. For some reason, it doesn't fetch a new data from calendar/reminder. Sometimes it fetches new data, sometimes it doesn't. Fetching the data from within the app works perfectly fine though. The problem happens only when fetching calendar/reminder is called from widget. From my research.... I found out that other popular apps have this problem with their widgets as well... Is this issue really a bug on iOS side, and if there is any workaround for now? My app is purely widget app so this bug is kinda big problem for me. Thank you.
1
0
1.2k
Nov ’22
Can a Watch-only App save and remove Events and Reminders?
Swift, EKEventStore supports watchOS, but the save and remove methods do not list watchOS as supported! How can I have a Watch-only App that utilizes events and reminders if they can't be created (and then saved) or deleted (and then removed) from the watch itself, and not having to bring iOS and another device (iPhone) into the mix? I tried it in code anyway, but Xcode tells me that save and remove are not supported on the watch! Thanks in advance for any help or advice.
0
0
787
Oct ’22
Command line app to show reminders
I'm trying to create a very simple command line app that shows all my reminders in the command line but I'm simply not getting any reminders shown (yes I do have some). import Foundation import EventKit let eventStore: EKEventStore = EKEventStore() let defaultList: EKCalendar? var hasAccess: Bool = false var reminders: [EKReminder]? eventStore.requestAccess(to: EKEntityType.reminder, completion: {(granted, error) in       hasAccess = granted ? true : false     }) print("Has access: \(hasAccess)") defaultList = eventStore.defaultCalendarForNewReminders() print("Default List: \(defaultList?.title ?? "NONE")") let lists = eventStore.calendars(for: .reminder) print(lists.map {$0.title}) eventStore.fetchReminders(matching: eventStore.predicateForReminders(in: nil)) { (_ rems: [EKReminder]?) -> Void in   print(rems)   reminders = rems   } print(reminders) As you can see, this is very simply. I get my hasAccess successfully and my defaultList and my lists but not my reminders. I think this is because the fetchReminders function takes a completion and so this is something to do with threads or callbacks or something but the requestAccess function also has a completion but that works. Please help!
1
0
1.2k
Oct ’22
iOS 16 Calendar Issue
I recently noticed that whenever I click on an event that I’ve created with invitees, then the RSVP responses shows that invitees have not yet responded and the invite sends out again to everyone… This is very frustrating and annoys a lot of people… Whenever I’d like to check the Times, Notes, Invitee Responses on an event, then everyone receives an invite again and needs to respond again! Anyone else experiencing this issue?
3
1
1k
Oct ’22
EventKit Broken on Ventura
My app is a Catalyst app for the Mac, iPad, and iPhone that reads and writes from reminders lists. For whatever reason it looks like EventKit on the Mac version is just not working at all. No reminders lists are returned when I ask for calendars of type reminder. No calendar is returned for the default calendar for new reminders function either. Everything seems to still work fine on iOS and iPadOS so I'm at a loss for why this would be happening on the Mac. It's always worked fine before. I've tried requesting access again but it just returns that I'm already authorized. I've tried toggling permission off and back on in system settings and that doesn't work either. I'm tempted to try something like logging out of iCloud and back in...but besides my issue locally I've been having users on Ventura beta write in to report the same issue. I definitely can't have all of my users who upgrade to Ventura sign out of iCloud and back in to fix this. They'd say I was crazy even if I tried. I wish I had spotted this earlier in the beta cycle but this is a pretty critical issue for me. Wondering if anyone has seen this or can think of a solution.
1
0
1.2k
Sep ’22
Is there icloud API to get calendar events
Hello, We are developing an app that coordinate meetings that needs to sync icalendar events with our app. We used EventKit and it is working fine on an apple device, but we also need to sync the data from the server (NodeJs) to be able to sync events even when the user doesn't open our app. How can we do so ? I found that we can sync using icloud and using "App-specific password" https://support.apple.com/en-us/HT204397 Some apps made by developers other than Apple ask you to sign in with your Apple ID, so that the app can access information like mail, contacts, and calendars that you store in iCloud. but I can't find an official documentation for the API. Can you please provide me with the API documentation or help me with an alternative. Thanks
1
0
1.7k
Sep ’22
EventKit in SwiftUI
I am new to Swift and I would like to make an app including complex calendar events. I have done some research this morning and I'm having trouble finding any documentation or tutorials on implementing EventKit in SwiftUI, everyone is using storyboard but I don't know how to use that. Is EventKit supported in swiftUI or do I have to start learning story board?
1
0
1.5k
Sep ’22
Why doesn’t iphone 13 associate downloaded .ics (iCal) files with the iOS calendar?
On iPhone 13, when I am on a website that offers a link to an .ics file containing one or more event and I choose to download the file, the iPhone does not give me the Calendar App as a suggestion to open the file. It seems to me, that there should most definitely be an association. Why is there not? Also, I am aware of the steps to otherwise subscribe to a URL, but I feel like that is too much work. the iPhone Calendar app should be able to handle importing an event from an ics file JUST as you can do on a MacBook. What am I missing? Is there an issue with my phone, or did Apple decide to not make the association for some reason?
0
1
1.1k
Aug ’22
Modify behavior of 'Delete Event' action inside the 'Event Details' view
Hi, I am developing an app which has a calendar integrated. This calendar comes from a package called CalendarKit (https://github.com/richardtop/CalendarKit ). With this calendar you can access to all the events of you mobile integrated calendar and create new ones, modify them, delete, etc. All the events on you mobile calendar are going to be represented here and the same in the other way, everything that you create here will be represented on you mobile calendar. So the main question is. How can i access to the 'Delete Event' action inside the 'Event Details' view? I know that i can delete an event programmatically, but i need to "modify" the behavior when clicking on the item 'Delete Event'. Is there any possible way to access to this item inside event details and when clicking on it do a custom action?. For example, when clicking i want to: print a text in the console, show an alert, get the EventID of the event deleted, etc. Can somebody help me with this?? Thanks a lot in advance.
1
0
977
Jul ’22
EKReminder URL property is nil
Quick question... how do I set the URL of a reminder? In the Reminders app, user can add a URL when they create a reminder.There's also a "url" property in EKCalendarItem (parent class of EKReminder).However, "url" is always nil both when I set it or when I read it from an existing reminder which contains a URL.Is this a bug?ThanksBill
Replies
4
Boosts
2
Views
2.1k
Activity
Dec ’22
Add multiple events to the Calendar with Concurrency
I created a function to add my course events to the calendar app using EventKit. After learning the swift concurrency, I want to update my code to make the progress much faster, namely using the detached task or TaskGroup to add these events. Synchronize code without detached task or task group: func export_test() { Task.detached { for i in 0...15 { print("Task \(i): Start") let courseEvent = EKEvent(eventStore: eventStore) courseEvent.title = "TEST" courseEvent.location = "TEST LOC" courseEvent.startDate = .now courseEvent.endDate = .now.addingTimeInterval(3600) courseEvent.calendar = eventStore.defaultCalendarForNewEvents courseEvent.addRecurrenceRule(EKRecurrenceRule(recurrenceWith: .daily, interval: 1, end: nil)) do { try eventStore.save(courseEvent, span: .futureEvents) } catch { print(error.localizedDescription) } print("Task \(i): Finished") } } } Doing the same thing using the TaskGroup : func export_test() { Task.detached { await withTaskGroup(of: Void.self) { group in for i in 0...15 { group.addTask { print("Task \(i): Start") let courseEvent = EKEvent(eventStore: eventStore) courseEvent.title = "TEST" courseEvent.location = "TEST LOC" courseEvent.startDate = .now courseEvent.endDate = .now.addingTimeInterval(3600) courseEvent.calendar = eventStore.defaultCalendarForNewEvents courseEvent.addRecurrenceRule(EKRecurrenceRule(recurrenceWith: .daily, interval: 1, end: nil)) do { try eventStore.save(courseEvent, span: .futureEvents) } catch { print(error.localizedDescription) } print("Task \(i): Finished") } } } } } The output of the TaskGroup version: Task 0: Start Task 1: Start Task 2: Start Task 4: Start Task 3: Start Task 5: Start Task 6: Start Task 7: Start Task 0: Finished Task 8: Start Task 1: Finished Task 9: Start Sometimes, only a few tasks will been done, and others will not, or even never been started (I created 16 tasks but only printed 9 in this example). Sometimes, all of these events can be added. In my point of view, I have created 16 child tasks in the TaskGroup. Each child task will add one event to the Calendar. I think in this way, I can take the full advantage of the multi-core performance (maybe it's actually not. 🙃) If I put the for-loop inside the group.addTask closure, it will always have the expected result, but in this way, we only have a single loop so the TaskGroup may no longer needed. I'm really exhausted🙃🙃.
Replies
1
Boosts
0
Views
1.8k
Activity
Dec ’22
Trying to Update Calendar, Getting Various Errors
I can add a new calendar to the user's calendars like this, using the saveCalendar(_:commit:) method: let ekStore = EKEventStore() func saveCalendar(calendar: EKCalendar) throws {     try ekStore.saveCalendar(calendar, commit: true) } let newList = EKCalendar(for: .reminder, eventStore: store.ekStore) newList.source = store.ekStore.defaultCalendarForNewReminders()?.source newList.title = newListName newList.cgColor = listColor do {     try saveCalendar(calendar: newList) } catch {     print("Error adding list: \(error.localizedDescription)") } And I store the calendar object. When the user finishes editing a calendar (reminders list) in my app, I try to save it like this, using the stored calendar as a starting point: let updatedList = existingCalendar updatedList.title = newListName updatedList.cgColor = listColor do {     try saveCalendar(calendar: updatedList) } catch {     print("Error saving list: \(error.localizedDescription)") } But the calendar doesn't save and I get this error: That account does not support reminders.. I have also tried explicitly setting the calendar's source: updatedList.source = store.ekStore.defaultCalendarForNewReminders()?.source but then I get this error: That calendar may not be moved to another account.. My Question: How do I update calendars (reminder lists) from my app?
Replies
0
Boosts
0
Views
1.4k
Activity
Dec ’22
How to receive data from iCloud calendar?
I'm creating an app that would need to connect to the user's calendar and interpret when they are busy and available based on the information, how would you do this?
Replies
0
Boosts
0
Views
842
Activity
Nov ’22
Since iOS 16.1, my widget started to not work properly. Seems like a bug. Can't access Calendar / reminder
My widget app was working fine before iOS 16.1. Since upgrading to 16.1 (and 16.1.1) my widgets starts to be buggy. For some reason, it doesn't fetch a new data from calendar/reminder. Sometimes it fetches new data, sometimes it doesn't. Fetching the data from within the app works perfectly fine though. The problem happens only when fetching calendar/reminder is called from widget. From my research.... I found out that other popular apps have this problem with their widgets as well... Is this issue really a bug on iOS side, and if there is any workaround for now? My app is purely widget app so this bug is kinda big problem for me. Thank you.
Replies
1
Boosts
0
Views
1.2k
Activity
Nov ’22
EventKit authorization in iOS16.1 app extensions
Something seems to have changed in the iOS16.1 beta regarding EventKit authorization in extensions - is anybody else seeing this? We have widgets that were able to access calendars and events previously, and are no longer able to do so. Checking EKAuthorizationStatus when debugging the Widget extension is now giving us a status of .denied.
Replies
2
Boosts
2
Views
1.5k
Activity
Nov ’22
EventKit EKReminder url, images & tags
The EKReminder class and its parent EKCalendarItem don't seem to offer access to the following members: url, images and tags. Am I missing something? Is there another way to access these members? Is this something I can request?
Replies
0
Boosts
7
Views
874
Activity
Oct ’22
Can a Watch-only App save and remove Events and Reminders?
Swift, EKEventStore supports watchOS, but the save and remove methods do not list watchOS as supported! How can I have a Watch-only App that utilizes events and reminders if they can't be created (and then saved) or deleted (and then removed) from the watch itself, and not having to bring iOS and another device (iPhone) into the mix? I tried it in code anyway, but Xcode tells me that save and remove are not supported on the watch! Thanks in advance for any help or advice.
Replies
0
Boosts
0
Views
787
Activity
Oct ’22
Command line app to show reminders
I'm trying to create a very simple command line app that shows all my reminders in the command line but I'm simply not getting any reminders shown (yes I do have some). import Foundation import EventKit let eventStore: EKEventStore = EKEventStore() let defaultList: EKCalendar? var hasAccess: Bool = false var reminders: [EKReminder]? eventStore.requestAccess(to: EKEntityType.reminder, completion: {(granted, error) in       hasAccess = granted ? true : false     }) print("Has access: \(hasAccess)") defaultList = eventStore.defaultCalendarForNewReminders() print("Default List: \(defaultList?.title ?? "NONE")") let lists = eventStore.calendars(for: .reminder) print(lists.map {$0.title}) eventStore.fetchReminders(matching: eventStore.predicateForReminders(in: nil)) { (_ rems: [EKReminder]?) -> Void in   print(rems)   reminders = rems   } print(reminders) As you can see, this is very simply. I get my hasAccess successfully and my defaultList and my lists but not my reminders. I think this is because the fetchReminders function takes a completion and so this is something to do with threads or callbacks or something but the requestAccess function also has a completion but that works. Please help!
Replies
1
Boosts
0
Views
1.2k
Activity
Oct ’22
how do i make this "copy to my calendar" link work?
i have a calendar opening in a webview in its own view controller. since this screen will encompass the calendar for the year, i need to be able to add the events to the calendars on people's phones. does any one know how i can do this?
Replies
0
Boosts
0
Views
696
Activity
Oct ’22
iOS 16 Calendar Issue
I recently noticed that whenever I click on an event that I’ve created with invitees, then the RSVP responses shows that invitees have not yet responded and the invite sends out again to everyone… This is very frustrating and annoys a lot of people… Whenever I’d like to check the Times, Notes, Invitee Responses on an event, then everyone receives an invite again and needs to respond again! Anyone else experiencing this issue?
Replies
3
Boosts
1
Views
1k
Activity
Oct ’22
TN3130: Changes to EventKit in macOS Ventura 13
Test your apps against EventKit API changes in macOS Ventura 13. View Technote TN3130 >
Replies
0
Boosts
0
Views
1.2k
Activity
Oct ’22
TN3132: Changes to EventKit and EventKitUI in iOS 16
Test your apps against EventKit and EventKitUI API changes in iOS 16. View Technote TN3132 >
Replies
0
Boosts
0
Views
776
Activity
Oct ’22
EventKit Broken on Ventura
My app is a Catalyst app for the Mac, iPad, and iPhone that reads and writes from reminders lists. For whatever reason it looks like EventKit on the Mac version is just not working at all. No reminders lists are returned when I ask for calendars of type reminder. No calendar is returned for the default calendar for new reminders function either. Everything seems to still work fine on iOS and iPadOS so I'm at a loss for why this would be happening on the Mac. It's always worked fine before. I've tried requesting access again but it just returns that I'm already authorized. I've tried toggling permission off and back on in system settings and that doesn't work either. I'm tempted to try something like logging out of iCloud and back in...but besides my issue locally I've been having users on Ventura beta write in to report the same issue. I definitely can't have all of my users who upgrade to Ventura sign out of iCloud and back in to fix this. They'd say I was crazy even if I tried. I wish I had spotted this earlier in the beta cycle but this is a pretty critical issue for me. Wondering if anyone has seen this or can think of a solution.
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’22
Re-ask to permission on update App specific version
How could I set App to re-ask permission after update (for specific version)
Replies
0
Boosts
0
Views
732
Activity
Sep ’22
Is there icloud API to get calendar events
Hello, We are developing an app that coordinate meetings that needs to sync icalendar events with our app. We used EventKit and it is working fine on an apple device, but we also need to sync the data from the server (NodeJs) to be able to sync events even when the user doesn't open our app. How can we do so ? I found that we can sync using icloud and using "App-specific password" https://support.apple.com/en-us/HT204397 Some apps made by developers other than Apple ask you to sign in with your Apple ID, so that the app can access information like mail, contacts, and calendars that you store in iCloud. but I can't find an official documentation for the API. Can you please provide me with the API documentation or help me with an alternative. Thanks
Replies
1
Boosts
0
Views
1.7k
Activity
Sep ’22
EventKit in SwiftUI
I am new to Swift and I would like to make an app including complex calendar events. I have done some research this morning and I'm having trouble finding any documentation or tutorials on implementing EventKit in SwiftUI, everyone is using storyboard but I don't know how to use that. Is EventKit supported in swiftUI or do I have to start learning story board?
Replies
1
Boosts
0
Views
1.5k
Activity
Sep ’22
Why doesn’t iphone 13 associate downloaded .ics (iCal) files with the iOS calendar?
On iPhone 13, when I am on a website that offers a link to an .ics file containing one or more event and I choose to download the file, the iPhone does not give me the Calendar App as a suggestion to open the file. It seems to me, that there should most definitely be an association. Why is there not? Also, I am aware of the steps to otherwise subscribe to a URL, but I feel like that is too much work. the iPhone Calendar app should be able to handle importing an event from an ics file JUST as you can do on a MacBook. What am I missing? Is there an issue with my phone, or did Apple decide to not make the association for some reason?
Replies
0
Boosts
1
Views
1.1k
Activity
Aug ’22
update / delete calendar color and name
Can anybody help me how to change in swift the color and name label for a calendar. Also the command how to delete a calendar in swift.
Replies
0
Boosts
0
Views
579
Activity
Jul ’22
Modify behavior of 'Delete Event' action inside the 'Event Details' view
Hi, I am developing an app which has a calendar integrated. This calendar comes from a package called CalendarKit (https://github.com/richardtop/CalendarKit ). With this calendar you can access to all the events of you mobile integrated calendar and create new ones, modify them, delete, etc. All the events on you mobile calendar are going to be represented here and the same in the other way, everything that you create here will be represented on you mobile calendar. So the main question is. How can i access to the 'Delete Event' action inside the 'Event Details' view? I know that i can delete an event programmatically, but i need to "modify" the behavior when clicking on the item 'Delete Event'. Is there any possible way to access to this item inside event details and when clicking on it do a custom action?. For example, when clicking i want to: print a text in the console, show an alert, get the EventID of the event deleted, etc. Can somebody help me with this?? Thanks a lot in advance.
Replies
1
Boosts
0
Views
977
Activity
Jul ’22