1
如何在iBooks上打開書籍?我想下面的代碼,這樣的作品,但要求用戶選擇的應用程序打開文件:如何在iBooks上打開文件
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的打開,不要求該用戶。
任何提示?