0

我试图用“打开方式”菜单打开一个 pdf 文件,但是当我创建它时,当我调用 presentOpenInMenuFromBarButtonItem 方法时代码崩溃

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

        [controller presentOpenInMenuFromBarButtonItem:_openInBBItem animated:YES];

没有错误信息。

你能帮助我吗 ?

4

1 回答 1

0

解决方案是在 UIDocumentInteractionController 上保留一个引用。

。H

@property UIDocumentInteractionController* interact;

.m

_interact = [UIDocumentInteractionController interactionControllerWithURL: fileUrl];
_interact.delegate = self;
[_interact presentOpenInMenuFromBarButtonItem: _openInBBItem animated:YES];
于 2013-05-27T10:01:17.877 回答