FileExplorer
FileExplorer copied to clipboard
Crash on iPad when tapping activity button
Console shows:
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIActivityViewController (<UIActivityViewController: 0x100e7e000>). In its current trait environment, the modalPresentationStyle of a UIActivityViewController with this style is UIModalPresentationPopover. You must provide location information for this popover through the view controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the view controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
Work around: In the file FileItemPresentationCoordinator.swift at the line 80, you can modify the code to:
func actionsViewControllerDidRequestShare(_ controller: ActionsViewController) { let activityViewController = UIActivityViewController(activityItems: [item.url], applicationActivities: nil) activityViewController.popoverPresentationController?.barButtonItem = controller.toolbar.items?[0] navigationController?.present(activityViewController, animated: true, completion: nil) }