2013-05-27 60 views
0

我試圖打開的「打開方式」菜單中選擇一個PDF文件,但是當我創建它,代碼崩潰時,我稱之爲presentOpenInMenuFromBarButtonItem方法UIDocumentInteractionController崩潰與presentOpenInMenuFromBarButtonItem:方法

UIDocumentInteractionController * controller; 
     controller = [UIDocumentInteractionController interactionControllerWithURL:fileUrl]; 
     controller.delegate = self; 

     [controller presentOpenInMenuFromBarButtonItem:_openInBBItem animated:YES]; 

沒有錯誤信息。

你能幫我嗎?

回答

0

解決方法是在UIDocumentInteractionController上保留一個引用。

.H

@property UIDocumentInteractionController* interact; 

.M

_interact = [UIDocumentInteractionController interactionControllerWithURL: fileUrl]; 
_interact.delegate = self; 
[_interact presentOpenInMenuFromBarButtonItem: _openInBBItem animated:YES];