2012-03-06 4 views
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]; 

나는 그것이 북스에서 직접 열고 자합니다.

팁이 있습니까?

답변

관련 문제