BlocksKit在Open In Dialogue中崩溃

时间:2013-10-10 16:13:53

标签: ios uidocumentinteraction

我有一个视图控制器通过一个小节按钮项打开一个“打开”对话框。

致电代码:

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类。 0x1f82b4f0是一个<A2DynamicDelegate: 0x1f82b4f0; protocol = UIPopoverControllerDelegate>,但为什么这里涉及BlocksKit是一个谜。有人能给我一些关于如何修复异常的见解吗?

1 个答案:

答案 0 :(得分:0)

BlocksKit有点像红鲱鱼。解雇代码在这里过早地取消分配UIDocumentInteractionController

    self.openInController = nil;

最早,释放应该在-documentInteractionControllerDidDismissOpenInMenu:委托回调方法之后进行。