FileExplorer icon indicating copy to clipboard operation
FileExplorer copied to clipboard

Crash on iPad when tapping activity button

Open YorrickBao opened this issue 7 years ago • 1 comments

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.'

YorrickBao avatar Apr 26 '17 03:04 YorrickBao

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) }

khanglbtk avatar May 26 '17 17:05 khanglbtk