cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

Can access file saved by a file manager app? (iOS)

Open thiagovargas opened this issue 6 years ago • 3 comments
trafficstars

Issue Type

  • [ ] Bug Report
  • [ ] Feature Request
  • [X] Support Question

Description

Information

I'm using this plugin to save PDF files to be stored by the user on their device's. On Android, i'm using externalRootDirectory and when using a file manager app, can i access the PDF file and open it. On iOS, i'm trying to use all of cordova.file.* (from iOS) and i can't find the saved pdf file from file manager app. Is it possible?

Command or Code

Environment, Platform, Device

iOS, iPhone 7

Version information

Checklist

  • [x] I searched for already existing GitHub issues about this
  • [x] I updated all Cordova tooling to their most recent version
  • [x] I included all the necessary information above

thiagovargas avatar Sep 05 '19 10:09 thiagovargas

Any updates for this?

Xiralv avatar Nov 14 '19 02:11 Xiralv

I'm not really an iOS expert but based on cordova docs and apple docs

It appears iOS apps are sandbox and has very limiting restrictions where the filesystem APIs only give you access to your own app files. Gaining access to other files outside of your app is done through their respective frameworks (as Apple calls them). For example, to gain access to pictures, you need the camera plugin, which contains APIs to get a picture from not only the camera, but the gallery as well.

Inside the core set of plugins that cordova provides, I don't think there is anything available to pick a general file or a document file outside of your app container. However, a third-party plugin such as this one may help you: https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin

On Android this shouldn't be a problem because apps have their own private filesystem like iOS does, but they also have access to a public filesystem as well.

breautek avatar Nov 15 '19 05:11 breautek

You can make documentsDirectory visible in File manager app by setting up UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace

<config-file parent="UIFileSharingEnabled" target="*-Info.plist">
    <true />
</config-file>
<config-file parent="LSSupportsOpeningDocumentsInPlace" target="*-Info.plist">
    <true />
</config-file>

https://stackoverflow.com/a/75657360/1302395

dFelinger avatar Feb 01 '24 07:02 dFelinger