0

I am trying to open ibooks from webview. When a user taps on a webview, I am showing all the apps they can use to open that certain pdf. But when i click on ibooks, app closes and nothing happens.

-(void) handleTap{
NSURL *pdfURL =[NSURL fileURLWithPath:self.url];// url is like https://www....

UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:pdfURL];


//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file.
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}

Thank you

Asif Alamgir
  • 1,454
  • 1
  • 16
  • 41

1 Answers1

1
NSURL *pdfURL =[NSURL fileURLWithPath:self.url];// !!! dpfURL = nil;

Please check pdfURL, it's value must be nil. Because the argument of method fileURLWithPath: should likes 'file:///...' not likes 'https://....'.

Hugo
  • 1,122
  • 11
  • 12