Save files in special folder - ios

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.

Related

Download file from my App and move it to a local folder

So I have created a JSON file in my app. Is there any way that I can move it, or download it from my app to the files folder and inside the Shortcuts folder? Thank You in Advance.
Your app doesn't have access to your user's global folders. You can use FileManager to save it to disk, but it will be in a folder that is specific to your app.
To save a file to a folder outside of your app's sandbox, you'll need to present a UIDocumentPickerViewController and allow the user to choose which folder to give your app access to.

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: 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.

upload file to folder on device, filesharing ios

im using filesharing in my app, working fine, but I want now for organization to be able to upload files from itunes to app folder
the itunes lets me import a file "Add", but i cannot drag the file to the created folder in my file system or "Add" in my folder,
so how can i upload the images to the specified folder in the device?
or do I have to dynamically check for the content of the /documents/ content and move the file to the wanted folder??
thanks
You can only add files via iTunes to the documents directory. You can either create your own AFP or WebDAV server on the iPhone and connect to it like a network drive (you have to code the server yourself). Alternatively you can check for new items in the documents directory as you suggested yourself and move them to wherever you want. Bear in mind that if you move them from the documents directory you will not be able to access them through iTunes once moved. Why don't you just store them in the documents directory anyway?

Copy file to/from NSDocumentDirectory during dev

I'm playing with NSDocumentDirectory and saving files on my iPhone. I have created a dictionary and saved it successfully to NSDocumentDirectory and I can re-load it upon re-launch of my app. However, during development I would like to actually browse and copy files to and from NSDocumentDirectory. Is there a way via X-Code or Finder or iTunes to see the contents of my app's NSDocumentDirectory?
The real goal here to move a file generated on my iPhone to my iPad, but starting with copying back and forth from Mac to device would be great!
Any advice is much appreciated.
You can transfer files to / from app's Document directory through the File sharing feature in iTunes. To do so, you have to set UIFileSharingEnabled property to YES in your app-info.plist. See this question if you have problems setting it up.
Download iFunBox. It will allow you to access the IOS file system.
The latest version is here.
IPhoneExplorer is available for Mac and Windows.

Resources