-
Notifications
You must be signed in to change notification settings - Fork 400
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
Add support for iOS 17 and fix the non-access problem for calendars #566
base: master
Are you sure you want to change the base?
Add support for iOS 17 and fix the non-access problem for calendars #566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about backward compatibility with older ios (<17)? Shouldn't we keep it?
EKEventStore* eventStoreCandidate = [[EKEventStore alloc] init];
if (@available(iOS 17.0, *)) {
[eventStoreCandidate requestFullAccessToEventsWithCompletion:^(BOOL granted, NSError *error) {
if (granted) {
self.eventStore = eventStoreCandidate;
NSLog(@"Full access to the event store granted and eventStore initialized.");
} else {
NSLog(@"Access to the event store not granted. Error: %@", error.localizedDescription);
}
}];
} else {
__block BOOL accessGranted = NO;
if([eventStoreCandidate respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
[eventStoreCandidate requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
accessGranted = granted;
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
} else { // we're on iOS 5 or older
accessGranted = YES;
}
if (accessGranted) {
self.eventStore = eventStoreCandidate;
}
}
`
I guess the rest of the plugin works fine on older OS versions, so no harm in keeping support. I'll update the PR accordingly. |
Do you think you need to add this to the plugin.xml ?
|
The issue I'm having with this code is that when I call |
Hello
I have exactly the same behaviour, the callback are called without waiting
for the response.
I also see something like Event authorisation given, but i dont know how to
"get" it.
Le ven. 29 sept. 2023 à 22:36, Matt Fantinel ***@***.***> a
écrit :
… The issue I'm having with this code is that when I call
requestReadWritePermission, it doesn't wait for the permission prompt to
complete, and instead errors out, but with a null error. Using the exact
same JS code suggested in the first post of this PR, you can see in the
screenshot below that the "permissions were not granted" log appears before
the "Full access to the event store granted" that is logged in the native
code.
[image: Xcode 2023-09-29 at 17 33 ***@***.***
<https://user-images.githubusercontent.com/24247035/271715311-ab044846-a653-40cf-9fd6-a84069054fb6.png>
—
Reply to this email directly, view it on GitHub
<#566 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJN5KOS2AVXSHTHR223LQUDX44WNPANCNFSM6AAAAAA5IJS6YU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I have created a new pull request to address the callbacks issue. |
@sjregan does that Pull Request completely replace this one? |
@matfantinel yes |
Hello Can you check the code please ? I tested and seems that "callbacks" are not ok, but they are ok with this version: #567 |
Added support for iOS 17 and a fix for the issue described here: #565
For the fix to work you need to make sure you ask for permissions in
deviceready
and the app must be built with iOS17 as a target in XCode.Do this for
deviceready
:A suggested function to run async is this: