Question

I tried to open a pdf file with the "Open in" menu, but when I create it, the code crash when I call the presentOpenInMenuFromBarButtonItem method

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

        [controller presentOpenInMenuFromBarButtonItem:_openInBBItem animated:YES];

There is no error message.

Can you help me ?

Was it helpful?

Solution

The solution is to keep a reference on the UIDocumentInteractionController.

.h

@property UIDocumentInteractionController* interact;

.m

_interact = [UIDocumentInteractionController interactionControllerWithURL: fileUrl];
_interact.delegate = self;
[_interact presentOpenInMenuFromBarButtonItem: _openInBBItem animated:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top