I'm building an app that allows the user to add and create events in the Calendar native app for iPhone. One of the features I'm working on is also to allow the user to add and create items in the Reminder's native app of the iPhone.
From what I've read, the Calendar and Reminders app work with EventKit, and from the documentation, the process of each don't differ too much.
I'm using this code to request permission to access Reminders and the code I use to add the items to the app.
Any thoughts on why is it not working? Thanks in advance.
import Foundation
import EventKit
class EventModel {
let eventStore = EKEventStore()
func requestAccessForReminders() {
let status = EKEventStore.authorizationStatus(for: .reminder)
if status == .authorized {
print("EKEventStore access for Reminders already granted.")
} else {
eventStore.requestFullAccessToEvents { success, error in
if success && error == nil {
print("EKEventStore access for Reminders has been granted.")
} else {
print("EKEventStore access for Reminders request failed with error: \(error?.localizedDescription ?? "Unknown error")")
}
}
}
}
func addEventToReminders(title: String, startHour: Int, startMinute: Int, duration: Int) -> Void {
let newEvent = EKReminder(eventStore: self.eventStore)
newEvent.title = title
newEvent.calendar = self.eventStore.defaultCalendarForNewReminders()
do {
try eventStore.save(newEvent,
commit: true)
} catch let error {
print("Reminder failed with error \(error.localizedDescription)")
}
}
}
This is the information I have in the info.plist. (I know is the same message, but that shouldn't be the main cause am I right?)

Your primary issue is that you are requesting access to the calendar, not to reminders. Use
requestFullAccessToRemindersfor iOS 17+ orrequestAccess(to: .reminder)for iOS 16- instead ofrequestFullAccessToEvents.Here's an updated version of your code that correctly requests access to reminders. This code handles iOS 17 as well as older versions of iOS. Obviously you need to call your
requestAccessForReminders()function before trying to add any reminders. It might be better to provide a completion handler forrequestAccessForRemindersso you know when the request has completed.