Open local file in InAppBrowser? Or how to save file to main iOS menu directory?

I’m using the file-transfer cordova plugin to download files and InAppBrowser to view remote ones, but I’m not able to:

  1. Save the file to the correct location (as in the main menu screen on iOS) using file-transfer

     let targetPath = cordova.file.syncedDataDirectory + file;
     fileTransfer.download(fileLocation, targetPath, (res) => {
       // manipulate the file etc
     }
    

syncedDataDirectory is obviously the wrong path, but documentsDirectory doesn’t store the file anywhere useful for the user either. The files are saving but I need them in a place the user can open them up in iBooks etc.

  1. Display a local file in InAppBrowser (something to do with safari sandboxing my files?)

     this.platform.ready().then(() => {
         cordova.InAppBrowser.open(url, "_system", "location=true");
     });
    

Safari will simply not let me display local files. Surely there must be a way?

I don’t mind which one (although i’d like to know what users would prefer themselves), I just want to find a solution for either.

Hi,

I have the same issue as you, impossible to open a local file from an Ionic App.
For info, if you want to check if your file in the right folder --> Use xCode

In xCode --> Window --> Devices and Simulators --> Gear icon --> Download container --> show package

And you will probably found your file in Library/Cloud/
If anyone have any ideas about how to read/open a pdf file from local app in iOS please comment bellow !