0

I am using the below code. When I try to export to a pdf, it works perfect. A menu shows up and opens the pdf in iBooks. But when I choose epub, the menu shows up and nothing happens when I click iBooks. Any idea what I am missing?

- (IBAction)openDocument:(id)sender {

    UIButton *button = (UIButton *)sender;
    NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *storePath = [applicationDocumentsDir stringByAppendingPathComponent:@"/pdf/helga.epub"];
    //NSString *storePath = [applicationDocumentsDir stringByAppendingPathComponent:@"/pdf/daskleinebuch.pdf"];
    NSURL *URL = [NSURL fileURLWithPath:storePath];
    //NSURL *URL = [[NSBundle mainBundle] URLForResource:@"sample" withExtension:@"pdf"];
    if (URL) {
        // Initialize Document Interaction Controller
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
        // Configure Document Interaction Controller
        [self.documentInteractionController setDelegate:self];
        // Present Open In Menu
        [self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];
    }

}
Undo
  • 25,519
  • 37
  • 106
  • 129
brugg
  • 1
  • This code looks ok, and as you get the menu, it seems irrelevant to the problem. You should check whether anything is wrong in UIDocumentInteractionControllerDelegate methods implementation. – Harish J Nov 29 '13 at 12:43
  • in fact i only added documentInteractionController in h and m file... seems this works with pdf without any methods. What do i miss what kind of methods are needed to open epub its a bit confusing cause it allready works with pdf – brugg Nov 29 '13 at 14:52
  • works now ... code works the problem was the epub file was not on the device .. the problem is, this does not work in the simulator only on the device :) and surely in the simulator i had the file so i searched on the wrong side, thanks – brugg Nov 29 '13 at 16:11

0 Answers0