datebook
datebook copied to clipboard
In ios download not working
Hi
I followed the guide and developed this portion of code in my app: `const calEvent = { title: appointment.medicalService.description, location: appointment.medicalService.supplierUnit, description: appointment.patientPreparation, start: appointment.date, end: addHours(appointment.date, 1) };
const icalendar = new ICalendar(calEvent); icalendar.download();`
But the download method does anything in ios. Any idea?
Thanks
Did you ever find a way around this?
Unfortunately no 😞Gian Marco Gallo (da iPhone)Il giorno 15 ago 2022, alle ore 19:58, Ross Coundon @.***> ha scritto: Did you ever find a way around this?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
I think i am facing the same problem as you.
In Xcode, the error thrown is NSOSStatusErrorDomain:
2022-09-13 10:58:32.673584+0200 App[24866:8027849] [default] Failed to open URL begin:VCALENDARVERSION:2.0 [... ICS CONTENT ...]: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=225, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}
Is that the same for you ? Any idea how to solve this ?
Thanks
At the end we decided to change the library and to use another one
@gigallo Can you tell me which one ? Thank you for the feedback.
@gigallo Thank you.
@gigallo I noticed that you're using Cordova, which uses the Safari webview. File downloading has been notoriously buggy for iOS which is why I put in a hack specifically for that platform.
However it seems that FileSaver.js already accounts for iOS -- I've removed that functionality in the latest version, and hopefully that should fix the issue.
A couple of things to note:
- For iOS specifically, the download will only work if a direct user action (e.g., onclick) directly triggers it. That means that any delay in between (even an instantaneous
setTimeout()
) will cause it to fail. As per FileSaver.js docs:
saveAs() must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering.
- In the next major release of Datebook,
download()
will be removed. More info here.