When I try to open any attachment, I temporarily write it to cache.
However I get an error “Unable to save” on this iphone 8. Is there a way around it or does capacitor just not work on older iphones?
public async viewFile(filename: string, fileData: ArrayBuffer, mimeType: string): Promise<void> {
let fileUrl: string = await this.writeFileToCache(filename, UtilClass.getFileDataAsBase64(mimeType, fileData));
if ((fileUrl || "").length > 0) {
await FileOpener.openFile({path: fileUrl, mimeType: mimeType}).catch(async (e) => {
if (e.message.startsWith("File cannot be opened.")) {
let alert: HTMLIonAlertElement = await this.alertController.create({
cssClass: "fp-alert",```
public async writeFileToCache(fileName: string, fileData: string): Promise<string> {
const savedFile: WriteFileResult = await Filesystem.writeFile({
path: `${fileName}`,
data: fileData,
directory: Directory.Cache
});
return savedFile.uri
}