datebook icon indicating copy to clipboard operation
datebook copied to clipboard

In ios download not working

Open gigallo opened this issue 2 years ago • 7 comments

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

gigallo avatar May 09 '22 10:05 gigallo

Did you ever find a way around this?

rcoundon avatar Aug 15 '22 17:08 rcoundon

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: @.***>

gigallo avatar Aug 15 '22 18:08 gigallo

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

apocheau avatar Sep 13 '22 09:09 apocheau

At the end we decided to change the library and to use another one

gigallo avatar Sep 13 '22 10:09 gigallo

@gigallo Can you tell me which one ? Thank you for the feedback.

apocheau avatar Sep 13 '22 14:09 apocheau

Of course. Here you are:

"cordova-plugin-calendar": "5.1.6", "@ionic-native/calendar": "^5.36.0"

gigallo avatar Sep 13 '22 15:09 gigallo

@gigallo Thank you.

apocheau avatar Sep 13 '22 15:09 apocheau

@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.

jshor avatar Nov 26 '22 22:11 jshor