For years a code for sharing something on iOS was something like this:
@IBAction func shareAll(_ sender: UIButton) {
let text ="text..."
let image = UIImage(named: "Product")
let myWebsite = NSURL(string:"https://somelink.com")
let shareAll= [text , image! , myWebsite]
let activityViewController = UIActivityViewController(activityItems: shareAll, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
self.present(activityViewController, animated: true, completion: nil)
}
Well, it does not work on iPads with iOS13+ anymore unless we add
activityViewController.popoverPresentationController?.sourceRect = ...
I doubt that behaviour was intended. Old code still works on iPhones. Console trace is below:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600001c68eb0 LPLinkView:0x7f834f833900.leading == UILayoutGuide:0x600000609a40'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600001c689b0 H:[LPLinkView:0x7f834f833900]-(59)-| (active, names: '|':_UIActivityContentTitleView:0x7f834f831f50 )>",
"<NSLayoutConstraint:0x600001c304b0 H:|-(0)-[_UIActivityContentTitleView:0x7f834f831f50] (active, names: '|':_UINavigationBarContentView:0x7f834cd91c80 )>",
"<NSLayoutConstraint:0x600001c24910 _UIActivityContentTitleView:0x7f834f831f50.trailing == _UINavigationBarContentView:0x7f834cd91c80.trailing (active)>",
"<NSLayoutConstraint:0x600001c600a0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7f834cd91c80.width == 0 (active)>",
"<NSLayoutConstraint:0x600001c684b0 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x600000609a40'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIActivityContentTitleView:0x7f834f831f50 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600001c68eb0 LPLinkView:0x7f834f833900.leading == UILayoutGuide:0x600000609a40'UIViewLayoutMarginsGuide'.leading (active)>