`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)
Post not yet marked as solved Up vote post of James26k Down vote post of James26k
956 views

Replies

Did you find a solution?

  • Hi, I have found the solution for my problem with the dialog for requesting access:

    in plist.info replace NSCalendarsUsageDescription with NSCalendarsFullAccessUsageDescription or NSCalendarsWriteOnlyAccessUsageDescription

  • Thanks that helped me a lot!

  • Worked for me as well. However I kept both keys in Info.plist. NSCalendarsUsageDescription and NSCalendarsFullAccessUsageDescription. Seems to work.

Add a Comment

Be sure to read TN3152: Migrating to the latest Calendar access levels.

  • I am still having this Issue even after adding the key to the info.plist. Does anyone have any further info on this issue?

    if #available(iOS 17.0, *) { store.requestFullAccessToEvents { granted, error in DispatchQueue.main.async { print("granted (granted)") } } }

    Never prompts the user to access the calendar.

Add a Comment

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.