How to allow user to view / select file from device in iOS

I want to allow the user to upload files in my iOS application, just like we upload a specific file to desktop applications with viewing various directories. I also searched, but did not find a reliable solution.

Someone is saying this.

The entire file system is not available if you are using a non-jailbroken phone. There are also no file system browser controls (for the same reason). However, you can browse the user's photo library or even take pictures with the camera using the UIImagePickerController.

Some questions were such

From these links and from other sources, I am only confused that I can provide the option of viewing the file to the user when the button is pressed. And if so, how can this be achieved? Any help would be appreciated.

If the user clicked the "Browse" button, the list should be there, for example

enter image description here

+6
source share
3 answers

IPhone applications are isolated. This means that you can only access files / folders inside your AppBundle (e.g. documents, cache, etc.). This is what the above URLs offer. You can only upload and download data from these folders.

Now, if you have a jailbroken phone, this is a different scenario. Without going into it.

Check out this link:

Apple iOS Environment under this The App Sandbox

+7
source

There is no standard control for this purpose, but using the methods mentioned in the posts you refer to, populating the table view is perfectly doable. Keep in mind that this will allow you to view files in the application sandbox. You cannot access files of other applications.

Alternatively, you can use open source libraries such as ios_file_browser or iOS-File-Browser . They provide a user interface, and you can also check the implementation.

+4
source

I am the author of FileExplorer , which is a file browser for iOS. It allows you to browse files and directories located inside your sandbox in a user-friendly way.

Here are some of my features:

  • The ability to select files and / or directories, if necessary
  • If possible, to delete files and / or directories, if necessary
  • Built-in search function
  • View audio, video, image and PDF files.
  • Ability to add support for any type of file.

You can find my control here .

0
source

Source: https://habr.com/ru/post/954654/


All Articles