In these questions (question 1 and question 2) it was answered how to use the url scheme or how to use the document interaction controller to display a pdf. On the first question there is a discussion about using the correct path to pass to the open function, and it seems it is posible despite other threads saying this functionality is not yet implemented (here) i know it is old but it wasn't answered.
So what i am trying to do is to open a file that is in my app's document folder. I have set to true the properties LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled so adobe reader is able to open my files from my documents folder instead of creating a new copy, and that works well with the document interaction controller, but if a try to open it with the open command it just opens the adobe reader app without a file.
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let fileURL = list[indexPath.row]
// Option 1 Open it using Document Interaction Controller
//let controller = UIDocumentInteractionController(url: fileURL)
//controller.delegate = self
//controller.presentPreview(animated: true)
// Option 2 Use URL Scheme
//let filePath = "com.adobe.adobe-reader://" + fileURL.absoluteString
//let filePath = "com.adobe.adobe-reader://" + String(fileURL.absoluteString.dropFirst(8))
let filePath = "com.adobe.adobe-reader://" + fileURL.path
UIApplication.shared.open(URL(string: filePath)!)
}
This is the path i am passing to the open method
"com.adobe.adobe-reader:///var/mobile/Containers/Data/Application/605AC702-F476-4108-8C54-AB2A3E0E2F15/Documents/OoPdfFormExample.pdf"
Any suggestions ? or do you notice something wrong ?
I am targeting iOS 11.2