Open Allenxuxu opened 1 year ago
@Allenxuxu please add steps to reproduce your issue. What didi you do that caused this exception? What did you expect should have happened instead if everything worked correctly?
@Allenxuxu please add steps to reproduce your issue. What didi you do that caused this exception? What did you expect should have happened instead if everything worked correctly?
In iOS17, if you call createOrUpdateEvent
, it can't work and print:
PlatformException(500, That account does not allow calendars to be added or removed., null, null)
In other version iOS, it works well.
is there some API or permission changes to ios17?
is there some API or permission changes to ios17?
not according to Apple's own documentation
is there some API or permission changes to ios17?
not according to Apple's own documentation
I feel weird too, but I'm not very good at swift. I think you can download a iOS 17 emulator and try it out, it's 100% reproduced in my case.
I have same issue...
@IVLIVS-III i think it is related to below.
@IVLIVS-III i think it is related to below.
@builttoroamadmin This seems very important. We probably need an update.
@IVLIVS-III or @builttoroamadmin is it possible to help here ?
@IVLIVS-III i think it is related to below. https://developer.apple.com/documentation/technotes/tn3152-migrating-to-the-latest-calendar-access-levels
@builttoroamadmin This seems very important. We probably need an update.
I tested it, as long as I give the APP full permissions in the settings (full access to events), I can use it normally. This package just request write-only access to events now. Therefore, I think we should only need to update the package code, just request full access to events permissions
any update on this ?
@kalismeras61 I submitted a workaround PR (https://github.com/builttoroam/device_calendar/pull/497)
You can try it by the following steps.
device_calendar:
git:
url: git://github.com/junqi/device_calendar.git
ref: fix/ios17-request-permissions
<key>NSCalendarsFullAccessUsageDescription</key>
<string>Access most functions for calendar viewing and editing.</string>
I tested it, as long as I give the APP full permissions in the settings (full access to events), I can use it normally. This package just request write-only access to events now. Therefore, I think we should only need to update the package code, just request full access to events permissions
@Allenxuxu I just tested the example app (current state of develop
branch, commit hash 3c24520
) on iOS Simulator on iOS 17.0 and it "just works" fine. I get two prompts:
What did you do differently?
A screen recording is attached below.
https://github.com/builttoroam/device_calendar/assets/48645716/c5aca14b-b77c-410f-8d1a-e7d63d04b515
Hello,When will this problem be solved?
device_calendar: git: url: git://github.com/junqi/device_calendar.git ref: fix/ios17-request-permissions
Use package as below
device_calendar:
git:
url: https://github.com/builttoroam/device_calendar.git
ref: develop
and don't forget to add info.plist
<key>NSCalendarsFullAccessUsageDescription</key>
<string>We need access to schedule calendar</string>
Do we have any estimated time when develop will be merged in stable?
Thanks 👍
Do we have any estimated time when develop will be merged in stable?
Thanks 👍
I have the same question 👍
we need an update asap, as its affecting ios 17 user
Maybe this PR is useful: https://github.com/Baseflow/flutter-permission-handler/pull/1220
@kalismeras61 's method worked for me
Do we have any estimated time when develop will be merged in stable?
Thanks 👍
Any update of it?
device_calendar: git: url: https://github.com/builttoroam/device_calendar.git ref: develop <key>NSCalendarsFullAccessUsageDescription</key> <string>We need access to schedule calendar</string>
Not the best way to fix it, because now the application requires full calendar access even if I need to add an event.
device_calendar: git: url: https://github.com/builttoroam/device_calendar.git ref: develop <key>NSCalendarsFullAccessUsageDescription</key> <string>We need access to schedule calendar</string>
Not the best way to fix it, because now the application requires full calendar access even if I need to add an event.
What's the difference between the 2 APIs? Are they for different things, or it's like a tiered system?
I have two errors using the GitHub Api: Swift Compiler Error (Xcode): Value of type 'EKEventStore' has no member 'requestFullAccessToEvents' Swift Compiler Error (Xcode): Type 'EKAuthorizationStatus' has no member 'fullAccess'
any ideas?
Hello guys,
To complete this issue, and after fork master and merge with this pull request : https://github.com/builttoroam/device_calendar/pull/519
You can have another problem with real iphone devices to create calendar with the same exception PlatformException(500, That account does not allow calendars to be added or removed., null, null)
The problem is the getSource function (in SwiftDeviceCalendarPlugin.swift) which may don't retrieve the right account (for exemple, if you have several accounts gmail and neither iCloud account by default nor local account)
$0.sourceIdentifier == "iCloud"
I don't know if it has been changed in iOS 17 but sourceIdentifier return an identifier like uuid
the "iCloud" is in the title attribute.
Also, I use the default Source in fallback solution.
So, when I test with `private func getSource() -> EKSource? {
let localSources = eventStore.sources.filter { $0.sourceType == .local }
if (!localSources.isEmpty) {
return localSources.first
}
let iCloudSources = eventStore.sources.filter { $0.sourceType == .calDAV && $0.title == "iCloud" }
if (!iCloudSources.isEmpty) {
return iCloudSources.first
}
if let defaultSource = eventStore.defaultCalendarForNewEvents?.source {
return defaultSource
}
return nil
}`
It's run perfectly on real device. Hope this helps
I have two errors using the GitHub Api: Swift Compiler Error (Xcode): Value of type 'EKEventStore' has no member 'requestFullAccessToEvents' Swift Compiler Error (Xcode): Type 'EKAuthorizationStatus' has no member 'fullAccess'
any ideas? I have the same problem
I still encountered this issue yesterday where I got [(401, That account does not allow calendars to be added or removed., null, null)] after granting full access to calendars and then trying to retrieve calendars using:
await _deviceCalendarPlugin.retrieveCalendars()
I'm running iOS 17.2 on the stimulator.
Where I differ from the OP is instead of restarting my app, I noticed that if when I navigate to another screen that also uses this package and then navigate back to the screen where I encountered this issue, then my calendars would get retrieved without error.
After some trial and error, I realized that before await _deviceCalendarPlugin.retrieveCalendars() I need to first do a permission check by first running:
await _deviceCalendarPlugin.requestPermissions();
Before I would only run await _deviceCalendarPlugin.hasPermissions() before trying to retrieve calendars with await _deviceCalendarPlugin.retrieveCalendars().
Hope this helps.
Describe the bug In iOS17 , it will print
PlatformException(500, That account does not allow calendars to be added or removed., null, null)
Flutter doctor [✓] Flutter (Channel stable, 3.10.1, on macOS 13.4.1 22F82 darwin-x64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.1) [✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3) [✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3) [✓] Connected device (3 available) [✓] Network resources
• No issues found!