How to share a folder from Files app on iOS? - ios

I can share a file from any application with my own application just by adding proper document type to my application .plist file. For example "public.image" document type enables images sharing.
But how can I share a folder from Files app with my application? I see that a folder also can be shared:
If to press "Share" then one can see that there are several apps which accept this folder as a sharing source. But my application is not in this list: it can accept single files but not folders. I have to note that this folder contains only files which are accepted by my application.
How to enable iOS application to accept folders using "Share" from Files app?

Related

How to access files in IOS that are stored in Files.app using react-native-fs?

I'm looking for a way to access the Files.app directory mainly the "Downloads" directory but the directory marked as "On My iPhone" would work as well. The use case will be a user downloads a certificate outside of the app into Files.app and the app will browse the directory for that certificate. I am using 'react-native-fs' and have tried using several file directory paths provided by the library such as DocumentDirectoryPath and LibraryDirectoryPath. I have also added UISupportsDocumentBrowser to the info.plist all with no luck.
Just for testing I am using:
RNFS.readDir(RNFS.DocumentDirectoryPath).then(files => {
console.log(files);
})
.catch(err => {
console.log(err.message, err.code);
});
The file manager cannot magically "see" into the Files app world. That world belongs to the Files app! You are sandboxed. You can allow the user to choose a file from the Files app using the documents browser, but you can't just magically peer into it.
If you are trying to access the Files.app you can open it through your app by adding LSApplicationQueriesSchemes as an Array in info.plist. Then add shareddocuments (without the ://). This allows Files to be opened on a button press if you want.
If you are trying to access a document in the filesystem on iOS then react-native-document-picker is a good one to use. I have done that to grab .CSV files stored anywhere on On My Ipad or Cloud.

iOS Files App Registration with file types

I store video files in the Documents folder of my app. I need to present an option that enables users to copy video files from Documents folder to iOS Files app. I also want to automatically have a folder for my app in iOS files app (as seen in the screenshot).
I tried registering Document type "public.movie" (screenshot 2) but didn't help.
Wondering how to achieve it.

Save files in special folder

I created application (Swift 4.2), 1st user sends URLs to 2nd user:
http://www.website.com/test1.zip
http://www.website.com/test2.exe
http://www.website.com/test3.png
http://www.website.com/test4.mkv
Second user should download and save files in folder at his device.
How can I download files and save them in "Files" folder?
Can I create "MyApplication" folder automatically and save files
inside this folder?
I think what you want is a Document-Based App. In this case, you must add and set UISupportsDocumentBrowser key to YES in your Info.plist file, then ALL your folders and files in your App Document Folder will be exposed here. When you open Files app, your App's documents will be at On My iPhone -> YOUR_APPLICATION_NAME
Hope this helps.
First Question:
You can download them on your pc and then transmit them to your iPad with apps like iFiles, which can be installed from Appstore.
Second Question:
To download files directly and save in your own folder is not permitted on iPad for the intentional restrict of Apple.

iOS: Support App Group folders in local file provider

I understand that if I provide the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys in Info.plist for my iOS app, files in my app's Documents folder are shown in Files.app ("On This iPad") and the documents browser.
Now my question - aside from writing a File Provider extension - is there any way to add an app group's folder or replace the Documents folder with a folder in the app group's folder?
For sharing between my extensions, I save everything in the App Group folder instead of Documents, but then, of course, Files.app doesn't have access to those files, that's why I'm asking.
I tried creating symbolic links from the documents folder to the actual file, and they are shown, but don't work correctly ("file doesn't exist").
I've also created a File Provider extension, but it was rejected by Apple because my extension isn't cloud-backed and was only for local files. According to my reviewer, a File Provider extension must be cloud-storage backed.
Thank you for your help and insights,
-Matt
It's pretty simple: No. :(
We are struggling with the same issue and its simple: You can't participate in the files app (or iTunes File Sharing) if you don't store your files in the Documents folder.
It seems like this is not well thought out. You should not integrate as a file provider unless you are actually providing a file system such as dropbox, at least that's what we've been told at WWDC. On the other side you should support stuff like iMessage extensions, today extensions,... which only are possible if your files are accessible through an app group. But this then automatically breaks the use of the Files.app as well as iTunes Filesharing.
We filed radars for that, any duplicate would help, I guess.

How to choose files from iPhone?

In my app I have to upload files to server.
For that I need to view and choose files from my iPhone and iPad. (any kind of files i.e pdf , doc,dock , mp3 etc etc).
How can I get the path for these files and how can I choose them in my application.
Generally in iPhone Where are these files are stored? how we can fetch them in our application?
Is there any thing like UIImagePickerController to pick file from iPhone?
There are classes that allow you to interact with various media types that may be on an iOS based device.
As you mention UIImagePickerController.
For music, you can use a similar class: MPMediaPickerControllerDelegate.
With regard to other arbitrary documents;
There is no device-wide document store, and you cannot access files stored inside another app's app bundle, thus you cannot access saved PDF/doc files. There is no shared place for the user to save such PDFs in the first place. Which is why media libraries have specific APIs to access them because they are device-wide libraries.
The most you can do is register your app as a viewer of PDF documents. This would allow other apps to open a PDF in your app if they use a UIDocumentInteractionController.
Your best option is probably to use File Sharing which will allow your application to own files on the device which can be synced via iTunes.
This will enable you to create your own UI, to present these files from your applications document folder.
Further reading: iOS File System Basics, File System Programming Guide.

Resources