Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to save PDF file directly into the file without using UIActivityViewController or UIDocumentInteractionController iOS?

Tags:

ios

swift

I need to save a PDF document from URL into the device. Is it possible to save the PDF and access it from device file manager without using UIActivityViewController or UIDocumentInteractionController.

like image 820
Thomas Paul Avatar asked Dec 18 '25 08:12

Thomas Paul


2 Answers

Add these 2 keys in your Info.plist: LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled. And set YES as the value for both.

Now you will be able use the Files app to see any file saved by your app in Documents Directory.

like image 62
Vlad M. Avatar answered Dec 19 '25 21:12

Vlad M.


Swift 5.0 and iOS13

let documentController = UIDocumentPickerViewController(url: exportToURL, in: .exportToService)
self.present(documentController, animated: true, completion: nil)

exportToURL represent application local URL whichever file want to save into iPhone Files app.

like image 36
Pratik Sodha Avatar answered Dec 19 '25 21:12

Pratik Sodha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!