rolinger
rolinger

Reputation: 3060

Cordova iOS download file to iPhones general "Downloads" folder

on iOS, is there ANY method that can allow an app to download a file to the iPhones general "Downloads" folder that the user can find on their iPhone (IE: using the iPhones Files app The Files app opens allowing users to navigate the iCloud storage OR the local On My iPhone.)

I have written four different methods that all succeed in downloading files to app sub-folders, but the users can't get to them because there is no way for the user to navigate to the apps sub-folders.

cordova-plugin-file-transfer - allows you to download files to app sub-folders.

inAppBrowser - doesn't allow download links to work, iOS prevents it

The only thing I have found is using a browser like Safari or Chrome to download the file...but this is an ugly solution that takes the user out of our app AND it requires exposing files on our web server requiring additional coding to only allow authorized users to download the selected files.

I can't be the only person with this issue....is there not a proper method to allow files to be downloaded to a publicly accessible place?

I mean, if iOS wants to completely sandbox apps, at least create symbolic links to downloaded files in an app download folder that is then symbolically linked back to the main Downloads folder. So the user would see something like:

Downloads --> MyAppDownloadFolder --> downloadedFile.pdf

So when users click to open the MyAppDownloadFolder they would be opening up the app sandboxed download folder.

Upvotes: 1

Views: 906

Answers (1)

Paulw11
Paulw11

Reputation: 114773

There isn't an easy way to save your files outside the Sandbox; You would have to use a UIDocumentPickerViewController to let the user specify a save location.

What you can do, easily, is add UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys to your info.plist with boolean true values.

This will then show your app's documents folder under your app name in "On my iPhone" in the Files app.

Upvotes: 3

Related Questions