Merott / nativescript-pdf-view

A basic PDF viewer plugin for NativeScript. Now maintained by @madmas: github.com/madmas/nativescript-pdf-view
Other
32 stars 35 forks source link

Unable to load local file in IOS #7

Closed satheeshsri closed 7 years ago

satheeshsri commented 8 years ago

Hi @Merott ,

Thanks for the cool plugin. I have trouble in loading pdf file in my local, it works fine in android.

Snippet:

html file:

.ts file: var documents = knownFolders.documents(); var file: File = documents.getFile("app/files/fye2016.pdf"); this.loadfile = fs.path.normalize(file.path); console.log(this.loadfile);

I verified the file in simulator path and fs.file.path() returns true as well. But pdf file is never loading only on ios (simulator & device). I see below error when I access PDF file, am I missing some config in .plist?

Error noticed on my console:

(Error) MC: MobileContainerManager gave us a path we weren't expecting; file a radar against them Expected:/private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

Thank you, Satheesh

Merott commented 7 years ago

@satheeshsri

Sorry for the long delay in getting back to you. Did you manage to get it working?

anki247 commented 6 years ago

If someone still runs to this problem... It is really mean that the example of @satheeshsri works on Android, which was for me really confusing. Anyway the solution is to use knownFolders.currentApp() instead of knownFolders.documents()


var appFolder = knownFolders.currentApp();
this.src = fs.path.join(appFolder.path, 'res_folder', 'xy.pdf');