pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
318 stars 587 forks source link

iOS 12.2 PDF not Viewing #262

Open CetasLakshman opened 5 years ago

CetasLakshman commented 5 years ago

Expected Behaviour

To Display the PDF on Default PDF Viewer.

Actual Behaviour

It Display Empty Screen.

Reproduce Scenario (including but not limited to)

Installed on I Phone 6S and Export any PDF from App

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Platform: iOS 12.2

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI info

8.1.2

cordova info

Here is the output:

Plugin version

cordova plugin version | grep cordova-plugin-file-opener2

Here is the output:

Cordova Plugin Version 2.2.0.

Sample Code that illustrates the problem

Logs taken while reproducing problem

No Error on App.

shnist commented 5 years ago

hi @CetasLakshman, thanks for raising this issue. Are you able to provide a snippet of the code that you are using to try and display the PDF file?

mrodal commented 5 years ago

Im having an issue too.. idk if its relate to this, but I can open pdfs on the emulator perfectly, but not on the real device.. unfortunately I dont have access to the real device to debug it right now :(

Happens only in iOS

Here's the code Im using to open the file:

async openDoc(state, { doc, tipoDoc }) {
      let filePath = await Filesystem.getUri({
        path: getDocPath(doc, tipoDoc),
        directory: FilesystemDirectory.Application,
      });
      try {
        await FileOpener.open(filePath.uri, 'application/pdf');
      } catch (e) {
         // Log 
      }
    },
mrodal commented 5 years ago

Ok, I found my problem, I cant write to the app directory, here's some more detail: https://stackoverflow.com/a/3439986/3552458