2013-10-10 54 views
1

我有一個視圖控制器,通過一個欄按鈕項目打開「Open-In」對話框。Open In Dialogue中BlocksKit崩潰

調用代碼:

UIDocumentInteractionController *docInteraction = [[UIDocumentInteractionController alloc] init]; 
docInteraction.URL = location; 
docInteraction.delegate = self; 
if ([docInteraction presentOpenInMenuFromBarButtonItem:self.openInButton animated:YES]) 
    self.openInController = docInteraction; 

解僱代碼:代碼駁回

UIDocumentInteractionController *openIn = self.openInController; 
if (openIn) { 
    [openIn dismissMenuAnimated:animated]; 
    self.openInController = nil; 
    popupsDismissed = YES; 
} 

有時,應用程序崩潰與此異常:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[A2DynamicUIPopoverControllerDelegate popoverController:animationCompleted:]: unrecognized selector sent to instance 0x1f82b4f0'

這是一個BlocksKit定義的接口,但我沒有使用BlocksKit cla在特定的情況下。 0x1f82b4f0是<A2DynamicDelegate: 0x1f82b4f0; protocol = UIPopoverControllerDelegate>,但爲什麼BlocksKit參與到這裏根本就是一個謎。有人能給我一些關於如何解決異常的見解嗎?

回答

0

BlocksKit是一個紅鯡魚的位。解僱代碼太早這裏取消分配UIDocumentInteractionController

self.openInController = nil; 

最早的釋放應該在-documentInteractionControllerDidDismissOpenInMenu:委託回調方法之後發生。