I'm developing a download and share file method to other apps using UIDocumentInteractionController
. But strangely, all I can get is "copy to" apps features, instead of "open in" apps. If I click on the "copy to", nothing happened, even though I know that what happens behind the screen is that the file is copied to the other app. But I don't want that the file is just copied. I want the other app to actually switch over and open the file.
This is the code I use to download and share the file:
Alamofire.download(url, to:destination)
.downloadProgress { (progress) in
print((String)(progress.fractionCompleted))
}
.responseData { (data) in
print("DOWNLOAD COMPLETED")
print("DESTINATION URL: \((data.destinationURL)!)")
print("DESTINATION PATH: \((data.destinationURL?.path)!)")
let documentController = UIDocumentInteractionController.init(url: (data.destinationURL)!)
documentController.delegate = self
documentController.presentOpenInMenu(from: CGRect.zero, in: self.view, animated: true)
}
The file that's particularly downloaded and shared in the screenshot above is a .PDF file.