You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using device_calendar through a singleton custom class CalendarService and I've been experiencing issues on iOS 17 lately.
Every time I wait a few seconds before approving calendar permission, the latter seems not to be taken into account until I restart my app.
INVOKE_CHANNEL_METHOD_ERROR: PlatformException(401, The user has not allowed this application to modify their calendar(s), null, null)
I went through EventKit documentation and I saw that EKEventStore instances should be long-lived : created and destroyed as little as possible during the lifetime of an application instance. So I tried implementing the Singleton pattern on our EKEventStore instance and it solved my problem. Which does not make much sense to me as I've got the same instance of DeviceCalendarPlugin everywhere in my app, so the instance of EKEventStore is the same.
# instance printed before requesting permissionflutter: <EKEventStore: 0x7febac45e680>
# instance printed after permission and before retrieving calendarsflutter: <EKEventStore: 0x7febac45e680>
I don't understand why it behaves this way. My only guess is that the static method EKEventStore.authorizationStatus(for: .event) does not catch up fast enough after eventStore request is approved, but it would be weird.
If anyone has a clue, I'd love to hear from you.
Should we make the EKEventStore instance a singleton ?
Thank you
The text was updated successfully, but these errors were encountered:
Hello,
I'm using device_calendar through a singleton custom class CalendarService and I've been experiencing issues on iOS 17 lately.
Every time I wait a few seconds before approving calendar permission, the latter seems not to be taken into account until I restart my app.
INVOKE_CHANNEL_METHOD_ERROR: PlatformException(401, The user has not allowed this application to modify their calendar(s), null, null)
I went through EventKit documentation and I saw that EKEventStore instances should be long-lived : created and destroyed as little as possible during the lifetime of an application instance. So I tried implementing the Singleton pattern on our EKEventStore instance and it solved my problem. Which does not make much sense to me as I've got the same instance of DeviceCalendarPlugin everywhere in my app, so the instance of EKEventStore is the same.
I don't understand why it behaves this way. My only guess is that the static method
EKEventStore.authorizationStatus(for: .event)
does not catch up fast enough after eventStore request is approved, but it would be weird.If anyone has a clue, I'd love to hear from you.
Should we make the EKEventStore instance a singleton ?
Thank you
The text was updated successfully, but these errors were encountered: