当我调用UIDocumentInteractionController方法“presentOpenInMenuFromRect:inView:animated:”时,iPad应用程序崩溃了。 [英] iPad application crashes when I call UIDocumentInteractionController method "presentOpenInMenuFromRect: inView: animated:"
本文介绍了当我调用UIDocumentInteractionController方法“presentOpenInMenuFromRect:inView:animated:”时,iPad应用程序崩溃了。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:在iPad中它崩溃了,列表出现但所选应用程序没有打开。
Here is my code: In iPad it is crashing in iPhone the list is appearing but the selected application is not getting open.
- (void)openIn:(NSURL *)fileFullPath {
docController = [UIDocumentInteractionController interactionControllerWithURL:fileFullPath];
[docController setDelegate:self];
BOOL isOpen = [docController presentPreviewAnimated:YES];
if (isOpen == NO) {
BOOL isOpenIn = [docController presentOpenInMenuFromRect:CGRectMake(300, 300, 100, 100) inView:self.view animated:NO];
if(isOpenIn == NO) {
return ;
}
}
}
推荐答案
根据Lupos的回答,为我的docController定义一个实例变量修复了你所看到的相同问题。
As per Lupos' answer, defining an instance variable for my docController fixed the same issue that you were seeing.
我没有足够的声誉来评论关于他的回答。
I don't have enough reputation to comment on his answer.
// In your .h file
@property (nonatomic, strong) UIDocumentInteractionController *docController;
// When calling in your .m
docController = [UIDocumentInteractionController interactionControllerWithURL:fileFullPath];
这篇关于当我调用UIDocumentInteractionController方法“presentOpenInMenuFromRect:inView:animated:”时,iPad应用程序崩溃了。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文