如何在iBooks上打开文件

我怎样才能打开一本关于iBooks的书? 我尝试了下面的代码,这是有效的,但要求用户select一个应用程序来打开文件:

self.docController = [UIDocumentInteractionController alloc]; //leaves only the file name NSString *bookFile = @"my-book.pdf"; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex: 0]; NSString* filePath = [documentsDirectory stringByAppendingPathComponent: bookFile]; // Using the Book path self.docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]]; // setting the delegate _docController.delegate = self; // open the menu only if we find a valid application that can // open the file BOOL isValid = [self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; 

我希望它直接在iBooks上打开,而不要求用户这样做。

有小费吗?

就用这个吧

 NSURL *url = [NSURL URLWithString:stringURL]; [[UIApplication sharedApplication] openURL:url]; 

其中stringUrl是你的文件path, itms-books:在开头

看到这个相关的问题如何在iPad上以编程方式启动iBooks电子阅读器?