How do I save files downloaded in my app to Downloads folder in Files app in Swift 4.2? - iphone

Is it possible to save the files downloaded from my app to be stored in the Downloads folder in Files App?
I am successful in creating my app folder in "On My iPhone" in Files and saving the files there.
However, my requirement is to save it in the Downloads folder in Files.
Is this possible? If so, how do I achieve this?

Related

Flutter - Where should I save downloaded files?

I am building a flutter app (iOS/Android/MacOS/Windows/Web) which is able to download files, selected by the user. But where should I save those files? On MacOS/Windows its easy using path_provider and get the path of the downloads folder.
But where should I save the files on the other platforms? The downloads folder would be perfect because the users are able to use those files (.pdf) even without using the app, so the files are not app specific.
If you wish to save in download directory you can use
Directory appDownloadDir = await getDownloadsDirectory();
String appDownloadPath = appDownloadDir.path;
Or
getExternalStorageDirectory()//android
getApplicationDocumentsDirectory()// ios doesnt support access to download folder

Deploy files in the localState folder during installation of a store app

I am building an app for windows store and I need some default and example data to be in the localstate folder (Windows.Storage.ApplicationData.current.localFolder) when the app run the first time.
The folder and files structure is a bit complex and I tryed to copy the files at the start of the application, but I can't manage that way.
Is it possible to have files being copied automatically from the installation folder to the localstate folder during the store app installation?
Unfortunately, customization of the app install process isn't currently supported. You have to do this as part of your first run processing.
One possibility is that you include the data in your package as a .ZIP or other compressed file and use an appropriate library to expand that file into a folder structure on startup. That could simplify your logic considerably. (I don't have a library to recommend; it's just an idea.)

How to download app data in Xcode 4.2

In the latest version of Xcode I could simply go to Organizer->MyDevice->Applications and then select the app I wanted to look at and download the appdata in form of a folder with all the app content. Now I only get a .xcappdata file.
How can I access this file for take a look in a .sqlite file?
Under the Data files in Sandbox pane in the Organizer, you'll find all the individual files that the selected app stores on the device and uses, displayed in a hierarchical view.
For my app, it looks like this:
To view the files in Finder, download the .xcappdata file, go to where you save it in Finder, Control-click on it and choose Show Package Contents. The directory structure is identical to what you see in the Organizer, and you can open and/or copy out the files as usual.
I'm constantly checking my app's database, so to speed things up I always download the .xcappdata to the same folder. I then run the following script that's sitting in that folder to look at the latest version of the database in 'sqliteman' (a sqlite program available through MacPorts):
#!/bin/bash
shopt - nullglob
for PACKAGE in *.xcappdata; do
CURRENT=$PACKAGE
done
sqliteman "$CURRENT/AppData/Documents/yourapphere.sqlite"

How to copy items from Documents directory to .app directory in iPhone App?

I have created a script that saves some files in the Documents directory of my app. Now I need to copy these files into my "application.app" bundle...
How I can do this? Thanks to everyone that can help me.
The .app bundle is code signed, you can't change its contents afterwards

when i am adding folder from other app to my app am getting error like no such file or directory

i am adding folder from other app folder and then put that folder in my app and i import folder files to my app file but i am getting error like no such file or directory while running.
If you're attempting to move folders between running iPhone applications, you can't because of the application sandbox that isolates the applications from each other.
If you're attempting to add files and folders to an Xcode project, you need to make sure they are added to the appropriate target. If they are resources like images, sounds, plist etc you must have Xcode copy them to the project folder to ensure they are included in the final product.