2014-09-18 71 views
0

我想從webview中打開ibooks。當用戶點擊web視圖時,我會顯示所有可用於打開該特定pdf的應用程序。但是當我點擊ibooks時,應用程序關閉並沒有任何反應。從ibooks中打開一個url崩潰

-(void) handleTap{ 
NSURL *pdfURL =[NSURL fileURLWithPath:self.url];// url is like https://www.... 

UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:pdfURL]; 


//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file. 
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; 
} 

謝謝

+0

你得到的任何特定的錯誤/異常? – MYK 2014-09-18 19:32:53

+0

我不知道,因爲。我正在測試一個現場設備,因爲模擬器不會允許我在ibooks中打開。我做了一個更新,將self.url替換爲本地文件(本地存儲),但仍然是相同的行爲 – 2014-09-18 19:38:34

+0

你不能調試它嗎? – MYK 2014-09-18 19:39:35

回答

1
NSURL *pdfURL =[NSURL fileURLWithPath:self.url];// !!! dpfURL = nil; 

請檢查pdfURL,它的值必須是nil。因爲方法fileURLWithPath:的參數應該喜歡'file:/// ...'不喜歡'https:// ....'。