[File Plugin] [File Plugin] SaveFile function not working on iOS

Forge Component
(4)
Published on 2018-10-16 by Pedro Oliveira
4 votes
Published on 2018-10-16 by Pedro Oliveira

Hello everyone.

So basically, I'm trying to use the SaveFile function to save a file in my downloads directory (both for Android and for iOS devices).

It seems to be working fine for Android, as I'm using this FilePath:

$parameters.FilePath = "/storage/emulated/0/Download";


But that's not the case for iOS devices. I'm setting my FilePath as:

$parameters.FilePath = cordova.file.documentsDirectory;

And when I try to use the SaveFile function, it returns the following error:

null is not an object (evaluating '$parameters.RootDirectory.getDirectory')


Does anyone have a clue on this? Should I use another FilePath?


Thank you,

Rui Barradas

Solution

Okay, so basically I was exploring the iOS and Android file systems. And I found that I could use the directory's name directly on the path.

So, both for iOS and Android, I decided the save the files in the Documents folder:

$parameters.FilePath = "Documents/";


This solution worked for me.


Cheers,

Rui Barradas

Solution