zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.1k stars 836 forks source link

Calendar permission fail on iOS 17 (will be released on Sept 18th) #804

Closed andrejguran closed 11 months ago

andrejguran commented 1 year ago

Bug summary

In new iOS 17 (to be relased on 18th of Sept) this permission request: https://github.com/zoontek/react-native-permissions/blob/33472788eac2526276477afd077b50f3a0855371/ios/Calendars/RNPermissionHandlerCalendars.m#L31 is deprecated and throw error: Error: -requestAccessToEntityType:completion: has been deprecated-calling this method is no longer allowed. Instead, use -requestFullAccessToEventsWithCompletion:, -requestWriteOnlyAccessToEventsWithCompletion:, or -requestFullAccessToRemindersWithCompletion:.

Deprication notice: https://developer.apple.com/documentation/eventkit/ekeventstore/1507547-requestaccesstoentitytype

Library version

3.9.0

Environment info

ios 17

Steps to reproduce

request calendar permissions on iOS 17

Reproducible sample code

`await request(PERMISSIONS.IOS.CALENDARS);`
zoontek commented 1 year ago

@andrejguran Does this actually really throw or is it more a deprecation warning?

Those two new methods just landed in iOS 17 beta, that would be weird for Apple to prevent old API usage and publish the replacements in the same version.

Usually, they let developers the time to migrate by supporting both for at least one major version.

andrejguran commented 1 year ago

@zoontek it's an error. Also they are deprecating EKAuthorizationStatus:authorized so the library will return incorrect status https://github.com/zoontek/react-native-permissions/blob/33472788eac2526276477afd077b50f3a0855371/ios/Calendars/RNPermissionHandlerCalendars.m#L24

It's possible that they will support both version, but I can't imagine how they'd support old authorized and new fullAccess and writeOnly statuses at the same time. I am leaning towards the possibility that on 18th when iOS 17 is released it will stop working.

zoontek commented 1 year ago

Fixed in first v4 alpha: https://github.com/zoontek/react-native-permissions/pull/808