2

I'm trying to send a downloaded pdf file from DocumentsDirectory to iBooks, and save it there. The code I used is:

    let url = URL(string: "itms-books://device_path_to_pdf_file/index.pdf")
    if UIApplication.shared.canOpenURL(url) {
      UIApplication.shared.openURL(url)
    } else {
      print("iBooks not installed")
    }

On runtime, this code opens iBooks on device but doesn't show the pdf file there. I'm running this code on Xcode 8.3-Beta and iOs 10.3 on device.

Any idea? Thank you.

RFG
  • 2,880
  • 3
  • 28
  • 44
  • My first guess is that you should use [UIDocument​Interaction​Controller](https://developer.apple.com/reference/uikit/uidocumentinteractioncontroller) – rckoenes Mar 22 '17 at 16:20
  • Yes, but I'd rather prefer only to show a 'Open in iBooks' button than all those UIDocumentInteractionController related options. – RFG Mar 22 '17 at 16:26
  • Well I think you have no option. Since your app is sandboxed and so are it files. Thus iBooks can't access it. – rckoenes Mar 22 '17 at 16:33
  • Do you find the Solution ??? if yes the share this @RFG – jakir hussain Jan 12 '18 at 05:16
  • No, as @rckoenes points, I've used UIDocumentInteractionController. – RFG Jan 15 '18 at 10:47

0 Answers0