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

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.

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.

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 download files to app from app folder without linking an account via Dropbox API?

How do you automatically download a file from Dropbox, say a .txt or .pdf file, from the app folder (Dropbox) programmatically without having the user link their account and do it manually? Is this even possible? The goal is to eventually display the file in the app.
Edit: I would like to clarify that the file would NOT be the user's. I am just trying to get my OWN file from the app's folder which is located under the developer's Dropbox AKA me.
Edit 2: I will be updating this file, which is why I'm storing it remotely on Dropbox. (to avoid having to repeatedly update the whole app) The purpose is to simply use my Dropbox as a database to retrieve this file from.

Where to store music?

I'm developing an application that downloads music from the web. I now need to upload it to the app store. But I don't know what folder I should save loaded music in. It says that for files downloaded from the Web, I need to use Library/Caches directory, but iOS can remove files from this directory. I don't want that to happen.
Store them either in the Documents or the Library directory. (NSDocumentsDirectory and NSLibraryDirectory constants, respectively.) iOS doesn't remove the files stored in there, as these are not temporary (tmp or Caches) paths.

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?

Resources