Closed moberwasserlechner closed 4 years ago
A little update on this. I was having the same issue and after looking into it I found out that on ipads the activity view controller is presented as a popover.
It needs either a sourceView
and a sourceRect
or a barButtonItem so it know where it should open from.
It seems that the sourceRect is not being set for the popoverPresentationController
I don't have time to test it right now, but you can try patching the Plugin.swift with:
(around line 23)
try dataObj.write(to: tmpUrl)
let capacitorView = self.bridge.viewController.view
let activityVC = UIActivityViewController(activityItems: [tmpUrl], applicationActivities: nil)
// on iphones the activityVC is presented modally
// on ipads its presented as a popover
// it needs a sourceView and a sourceRect which is a bounds (coordinates)
// from where the controller opens. If we dont provide the sourceRect the popover opens
// next to the view (outside) breaking the contraints
activityVC.popoverPresentationController?.sourceView = capacitorView
activityVC.popoverPresentationController?.sourceRect = CGRect(x: capacitorView?.center.x ?? 0, y: capacitorView?.bounds.size.height ?? 0, width: 0, height: 0)
DispatchQueue.main.async {
self.bridge.viewController.present(activityVC, animated: true, completion: { call.resolve() })
}
Its not a perfect solution since this always makes the popover to appear from the same spot (bottom of the screen, on the middle) but it should be working
@nikosdouvlis Thx for looking into it.
The dialog is not shown any more on at least IOS 13.2.1 and 13.3.
XCode Debug output