Constraints Issue with alert popover

Hey guys. I have tried setting a symbolic breakpoint and I can't seem to see where the issue is coming from. So here's the code:
It's a popover alert button that presents a constraint issue when clicked.

Code Block
private lazy var SocialBtn: UIButton = {
let button = UIButton(type: .custom)
button.setTitle(" + ", for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 30)
button.setTitleColor(.red, for: .normal)
button.addTarget(self, action: #selector(btnPressed), for: .touchUpInside)
return button
}()


here is how I set up the button:

Code Block
@objc private func btnPressed(_ sender: UIButton) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.modalPresentationStyle = .popover
let image = UIImage(named: "instagram")
let imageView = UIImageView()
imageView.image = image
imageView.contentMode = .scaleAspectFit
imageView.frame = CGRect(x: 25, y: 12, width: 35, height: 35)
alert.view.addSubview(imageView)
let image1 = UIImage(named: "tripadvisor")
let imageView1 = UIImageView()
imageView1.image = image1
imageView1.contentMode = .scaleAspectFit
alert.view.addSubview(imageView1)
imageView1.frame = CGRect(x: 25, y: 60, width: 40, height: 50)
let shareExternal = UIAlertAction(title: NSLocalizedString("Tripadvisor", comment: ""), style: .default) { action in
if let url = URL(string: self.link1) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:])
}
}
}
let shareInApp = UIAlertAction(title: "Instagram", style: .default) {
action in
print("Insta")
if let url = URL(string: self.link2) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:])
}
}
}
let cancel = UIAlertAction(title: "Cancel", style: .cancel) {
action in
print("cancel")
}
alert.addAction(shareInApp)
alert.addAction(shareExternal)
alert.addAction(cancel)
if let presenter = alert.popoverPresentationController
{
presenter.sourceView = SocialBtn
presenter.sourceRect = SocialBtn.bounds
}
present(alert, animated: true, completion: nil)
}


Here is the error that I am getting.

Code Block
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:0x283694e60 UIView:0x116024990.width == - 16 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x283694e60 UIView:0x116024990.width == - 16 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Not sure, probably a relatively harmless iOS bug. But you should be aware that a UIAlertController’s view hierarchy is considered private API. If you need a customized alert you need to roll your own view controller. Modifying UIAlertView directly has burned many developers in the past as the underlying implementation is subject to change at any time. I’m sure the same will happen with UIAlertController eventually.

From the documentation: “Important - The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.”
Thanks!

Constraints Issue with alert popover
 
 
Q