My task is to implement the Quick Look functionality in a way to present options for opening the chosen document. I'm using the UIDocumentInteractionController's PresentOptionsMenu method to display the options. The Quick Look icon is displayed but when I click on it then nothing happens. The popup with the options closes and the document is not opened.
What do I do wrong? Why is to document not opened after clicking on the Quick Look icon?
The popup displayed after selecting a document
My code is:
public class DataViewer
{
public event EventHandler DocumentOpened;
public async Task OpenDocument(string filePath)
{
var viewer = UIDocumentInteractionController.FromUrl(new NSUrl(filePath, false));
viewer.WillBeginSendingToApplication += async (sender, args) =>
{
DocumentOpened?.Invoke(this, EventArgs.Empty);
};
var controller = UIApplication.SharedApplication.KeyWindow.RootViewController;
viewer.PresentOptionsMenu(controller.View.Frame, controller.View, true);
}
}