0

how to access any document files from device to our application for uploading to server and downloading from server ,save in device not in App can any one help me how to do this? i searched from many days, but i didn't get any solution to how to get files from the device.

UIDocumentInteractionController *pdfPicker = [[UIDocumentInteractionController alloc] init];
pdfPicker.delegate = self; // ensure you set the delegate so when a PDF is chosen the right method can be called

[self presentViewController:pdfPicker animated:YES completion:nil];

i also implemented this code but its crashing the app. please help me, thanks in Advance.

2 Answers2

0

Not Possible, You can not get list of documents available in other app from your app. however, if you want to bring files from other other app to your app you can implement following:

1) Register your app for supporting file type by defining required values in plist. in this way, when user will see file in mail, safari or some other app, they will see your app in open with option. how to register the app to open the pdf file in my app in ipad

2) Create share extension: whenever user will share file which you are supporting, they will see your app in option.

Code to share file path/file between a share extension and iOS app

from both option above, you will get selected document path into your app. you can upload that doc to server if required.

Community
  • 1
  • 1
PlusInfosys
  • 3,416
  • 1
  • 19
  • 33
  • If your answer is majorly about linking other stackoverflow answers, it should be a comment instead of an answer – NSNoob Oct 24 '16 at 11:04
0

It is not possible to access all files in an iOS device outside the sandbox of the app. What you can do is:

  • Access all the files in Gallery using UIImagePickerController.
  • Access all the user files in network- Dropbox/Google drive/iCloud. They all have separate public APIs that can be downloaded and used to download/upload files in network.

In this way, you can access most of the user files and use the same in your application.

Manishankar
  • 327
  • 1
  • 12