`requestFullAccessToEvents(completion:)` does not work

Hi, I am facing a problem related to the API in the title.

When the API is executed with EKAuthorizationStatus notDetermined, the dialog is not displayed and (false, nil) is passed to completion.

// Create an event store
let store = EKEventStore()

store.requestWriteOnlyAccessToEvents { granted, error in
    if let error {
        print("error occurred")
    } else if granted {
        print("allowed")
    } else {
        print("denied")
    }
}

// "denied"

That is why I am not sure what is causing the dialog not to appear.

Is this a bug in the API?

note

This is not a problem in the simulator. It is a problem **only on the actual device.

development environment

  • Xcode Version 15.0 (15A240d)
  • iPhone SE(3rd) iOS 17.0.2 (21A351)

Did you find a solution?

For us, it was the missing entries in Info.plist. Make sure to add the new entries

Also, keep in mind, that if you're still supporting older iOS versions (lower than 17), you should also include the NSCalendarsUsageDescription.

`requestFullAccessToEvents(completion:)` does not work
 
 
Q