Calendar authorizationStatus changed to Denied without user's interaction. Calendar Full Access Permission

I have experienced a strange issue on my iphone test device. (iPhone Xr running iOS 17.0.3)

In my app I ask a user for calendar full access. Once I gave the access permission, the app works as expected. Then somehow the status changed from .fullAccess to .denied. This happens without my interaction in iPhone's Settings. I have doubled checked in Settings app and the permission is still granted. But somehow the status is denied when calling EKEventStore.authorizationStatus(for: .reminder)

  • Regardless of how bad my code is, the app should not be able to change status from .fullAccess to .denied. Correct?

  • I have never had this problem until lately. But it happens to both my iOS app and my mac Catalyst app. Which is really strange. (iOS 17.0.3 and Sonoma 14.0)

  • This problem doesn't happen all the time though. Most of the time my app works fine. But it can happen few times per day. And even more strange, it tends to happen at the same time for iOS and macOS.

I don't know if this problem happens to me because of the fact that I install/uninstall the app many times but currently it just causes me a headache.

I have attached 2 images. These 2 images happen at the same time. The only fix is that I have to turn off then turn on the Full Access again in Settings app. Something for Reminder.

Any advice is much appreciated. Thank you.

Problem fixed.

Well..... Not sure if this is the cause of this problem but after applying this fix I don't see this error anymore..

It turns out that I have error in accessing EKEventStore. Xcode gives me this error:

"Client tried to open too many connections to calaccessd. Refusing to open another."

In my app, I have carelessly initialized EKEventStore() many times. While this had no problem in iOS16, it caused me the above error in iOS17

let eventStore = EKEventStore()

The fix is to create a new class like this:

class EventStoreManager: ObservableObject {
    static let shared = EventStoreManager()

    let eventStore: EKEventStore

    private init() {
        eventStore = EKEventStore()
    }
}

Then when I want to access the EKEventStore either in View Struct or function, do this:

let eventStore = EventStoreManager.shared.eventStore

After doing this I have no error from Xcode anymore. And no issue with access to EKEventStore.

Hope this might help.

Exactly my problem too and this fixed it for me as well.

Calendar authorizationStatus changed to Denied without user's interaction. Calendar Full Access Permission
 
 
Q