Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS17 Calendar Permission Changes #180

Closed
kohchihao opened this issue Oct 5, 2023 · 10 comments
Closed

iOS17 Calendar Permission Changes #180

kohchihao opened this issue Oct 5, 2023 · 10 comments

Comments

@kohchihao
Copy link

kohchihao commented Oct 5, 2023

There are new changes to the iOS17 Calendar permission where 2 new permissions are introduced full access and write only.

This will cause the presentEventCreatingDialog to be broken on iOS17 because when checking the permission and requesting via requestAccessToEntityType will cause the app to throw an error. Specifically the requestAccessToEntityType is deprecated on iOS17 and 2 new methods are introduced.

Ref:

I think other libraries are facing the same issues as well wmcmahan/react-native-calendar-events#440

@leonardohenriquedev
Copy link

A workaround that i made is request permissions by react-native-calendar-events like this:

import ReactNativeCalendarEvents from "react-native-calendar-events";
import { presentEventCreatingDialog } from "react-native-add-calendar-event";

    ReactNativeCalendarEvents.requestPermissions().then((response) => {
      if (response === "authorized")
        try {
          presentEventCreatingDialog({ title: "" })
            .then((eventInfo) => {
              console.log(JSON.stringify(eventInfo));
            })
            .catch((error) => {
              console.log(error);
            });
        } catch (error) {
          console.log("calendar error:", error);
        }
    });

But first you need to make this change in your RNCalendarEvents.m file from react-native-calendar-events agent8/react-native-calendar-events@368206c

@phatlaunchdeck
Copy link

phatlaunchdeck commented Nov 5, 2023

A workaround that i made is request permissions by react-native-calendar-events like this:

import ReactNativeCalendarEvents from "react-native-calendar-events"; import { presentEventCreatingDialog } from "react-native-add-calendar-event";

    ReactNativeCalendarEvents.requestPermissions().then((response) => {
      if (response === "authorized")
        try {
          presentEventCreatingDialog({ title: "" })
            .then((eventInfo) => {
              console.log(JSON.stringify(eventInfo));
            })
            .catch((error) => {
              console.log(error);
            });
        } catch (error) {
          console.log("calendar error:", error);
        }
    });

But first you need to make this change in your RNCalendarEvents.m file from react-native-calendar-events agent8/react-native-calendar-events@368206c

Would it be simpler by just calling Permissions.request() from react-native-permissions so that we don't have to modify react-native-calendar-events?

@claudiozam
Copy link

@phatlaunchdeck we also have problems in react-native-permissions zoontek/react-native-permissions#804

@remipou
Copy link

remipou commented Nov 26, 2023

I made it work this way: master...remipou:react-native-add-calendar-event:master
Don't forget to add a NSCalendarsWriteOnlyAccessUsageDescription key in your info.plist
(#182)

@tholmgren
Copy link

I made it work this way: master...remipou:react-native-add-calendar-event:master Don't forget to add a NSCalendarsWriteOnlyAccessUsageDescription key in your info.plist (#182)

Thank you, Remipou. This worked great for me!

@ChronoByteCosmonaut
Copy link

NSCalendarsUsageDescription has been deprecated.
If your app needs read and write access to a person’s calendar data, use NSCalendarsFullAccessUsageDescription instead. If your app needs to create events in a person’s default calendar, use NSCalendarsWriteOnlyAccessUsageDescription
instead.

[https://developer.apple.com/documentation/bundleresources/information_property_list/nscalendarsusagedescription]

@ChronoByteCosmonaut
Copy link

I made it work this way: master...remipou:react-native-add-calendar-event:master Don't forget to add a NSCalendarsWriteOnlyAccessUsageDescription key in your info.plist (#182)

Thank you, Remipou. This worked great for me!

Is there any way to mergen this PR??

@ChronoByteCosmonaut
Copy link

ChronoByteCosmonaut commented Dec 18, 2023

Any updates? Can @remipou ‘s fix be merged? @vonovak ? Or how can I use it in the mean time? Thanks!

@ChronoByteCosmonaut
Copy link

Any updates on this PR??

@vonovak
Copy link
Owner

vonovak commented Jan 6, 2024

Thus library no longer deals with permissions.
Please use rn-permissions or similar, as documented in the Readme.

@vonovak vonovak closed this as completed Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants