191
Views
3
Comments
Solved
[File Plugin] [File Plugin] SaveFile function not working on iOS
file-plugin
Mobile icon
Forge component by Platform Maintenace

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

mvp_badge
MVP
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

Rui Barradas wrote:

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

 Hi Rui, good morning. Where would you access these files on your phone? For iOS, there isn't really a documents folder, apart from the "Files" app. Thanks for the advice. 

 

Hi Rui, R Y,

Are you guys able to download file on IOS?  I tried both file paths (Documents/ and Files/) but i can't find my downloaded file in device. This solution not working for me. 


Thank you,

Narendra

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.