Open amartya-dev opened 3 years ago
I am also facing this issue
I have tested it multiple times, but as soon as I generate an
ics
file and add an event with it in my iPhone, it almost always fails.My code:
ics.createEvent( { title: this.webinarTitle, start: [ date.getFullYear(), date.getMonth(), date.getDay(), date.getHours(), date.getMinutes(), ], duration: { hours: this.webinarDuration }, organizer: { name: this.webinarHost.first_name + ' ' + this.webinarHost.last_name, email: this.webinarHost.email, }, }, (error, value) => { if (error) { console.log(error) } var filename = `${this.webinarTitle}-invite.ics` console.log(value) var blob = new Blob([value], { type: 'text/calendar;charset=utf8', encoding: 'UTF-8', }) console.log(blob.type) if (window.navigator.msSaveOrOpenBlob) { window.navigator.msSaveBlob(blob, filename) } else { var elem = window.document.createElement('a') elem.href = window.URL.createObjectURL(blob) elem.download = filename document.body.appendChild(elem) elem.click() document.body.removeChild(elem) } } )
Here is what I did that worked:
const { value } = createEvent(event);
const data = new Blob([value], { type: 'text/calendar' });
do not add UTF-8 as encoding.
I'm placing it in an Uint8Array typed array with a format of 'ics' and its not working. having to do this to upload to cloudinary cdn
Anyone to help here. Facing the same issue.
I have tested it multiple times, but as soon as I generate an
ics
file and add an event with it in my iPhone, it almost always fails.My code: