iOS Files App Registration with file types - ios

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.

Related

How to share a folder from Files app on 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?

How to Save video file to iOS Files App using UIDocumentInteractionController

I want to write one or multiple mov/mp4 files to iOS Files App but can not find how to do it with UIDocumentInteractionController. Looking for a sample code to copy files to a subfolder of my app in iOS files app using UIDocumentInteractionController. See sample screenshot to understand what I want.
You will first need to create a File Provider extension for your app if you are storing the files remotely.
If they are only being stored locally on device you can achieve this by (in the Info.plist) either setting the UISupportsDocumentBrowser key, or by setting bother the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys.
As explained in this documentation:
These keys enable other apps to open and edit the contents of your Documents directory in place. Your files also appear in both the Files app and the document browser. For more information, see the UIDocumentBrowserViewController class.

How do you process multiple files shared from the iOS Files App

I have an app that can open files shared with it. If I select multiple files in the iOS Files app and share them with my app, my UIApplicationDelegate's open url handler is called once with the URL of the first file. The remaining files are not reported to my delegate. Does anyone know how to get the obtain the URLs of all the shared files?
I need a solution for iOS 11 and above.

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.

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