iphone - UIDocumentInteractionController 自 iOS6 起不起作用

标签 iphone ios objective-c

这个问题在这里已经有了答案:





UIDocumentInteractionController no longer works in iOS6

(2 个回答)


9年前关闭。




在我的应用程序中,我使用 UIDocumentInteractionController 将 pdf 文档打开到 acrobat 阅读器(或任何其他查看器)中,但从 iOS6 开始它不再工作了。

我尝试了很多东西,最后一个来自here :

UIDocumentInteractionController *docController = [[UIDocumentInteractionController alloc]init];
docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:documentsDirectory]];
docControler.UTI = @"com.adobe.pdf";
docController.delegate = self;
CGrect navRect = self.view.frame;
[docController presentOpenInMenuFromRect:navRect inView:self.view animated:YES];

当此代码运行时,我的应用程序完全卡住。
我尝试使用“presentOpenInMenuFromBarButtonItem”,但我遇到了同样的问题。

最佳答案

将 Controller 分配给强引用的属性:

@property (nonatomic, strong) UIDocumentInteractionController *docController;

关于iphone - UIDocumentInteractionController 自 iOS6 起不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15881176/

相关文章:

iphone - UIKeyboard 通知的最佳实践 - iPhone SDK

ios - 如何发布 One Signal 通知的附加数据并接收这些数据?

ios - 解析 - 检查用户是否存在

ios - 为什么 Objective-C API 会返回隐式解包的可选值?

javascript - 用户不允许的地理定位 - 第二次通知用户

iphone - 显示 UINavigationBar 后退按钮而不按下 View Controller

iphone - UINavigationBar 自定义字体

ios - 如何关闭单个React Native模拟器?

IOS如何将JSON字符串保存和加载到内存

objective-c - "[AnyObject]"与 "NSArray"不同