Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad application crashes when I call UIDocumentInteractionController method "presentOpenInMenuFromRect: inView: animated:"

Tags:

ios

iphone

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 ;
        }
    }
}
like image 490
Dee Avatar asked Jul 22 '26 01:07

Dee


1 Answers

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];
like image 141
Mal Curtis Avatar answered Jul 23 '26 15:07

Mal Curtis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!