Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on iPad when tapping activity button #29

Open
YorrickBao opened this issue Apr 26, 2017 · 1 comment
Open

Crash on iPad when tapping activity button #29

YorrickBao opened this issue Apr 26, 2017 · 1 comment

Comments

@YorrickBao
Copy link

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
Copy link

khanglbtk commented May 26, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants