Augustyniak / FileExplorer

FileExplorer is a powerful iOS file browser that allows its users to choose and remove files and/or directories
Other
742 stars 112 forks source link

Crash on iPad when tapping activity button #29

Open YorrickBao opened 7 years ago

YorrickBao commented 7 years ago

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

khanglbtk commented 7 years ago

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