从app内打开iBooks中的epub

时间:2013-11-29 10:12:19

标签: ios ipad pdf epub ibooks

我正在使用以下代码。当我尝试导出到pdf时,它完美无缺。菜单显示并在iBooks中打开pdf。但是当我选择epub时,菜单显示,当我点击iBooks时没有任何反应。知道我错过了什么吗?

- (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];
    }

}

0 个答案:

没有答案