Swift programmatic UI UIContextMenuInteraction Auto layout error (groupView) on opening context menu

I have an app with a programmatic UI (No storyboards). I add a context menu to a button of my viewcontroller. On opening this menu (tap and hold on the button) I get a LayoutConstraints warning/error in the console (menu works fine otherwise):


Code Block
(
"<NSAutoresizingMaskLayoutConstraint:0x600001c9ed50 h=--& v=--& UIInterfaceActionGroupView:0x7f9d4478ceb0.height == 0 (active)>",
"<NSLayoutConstraint:0x600001cd7c50 groupView.actionsSequence....height >= 66 (active, names: groupView.actionsSequence...:0x7f9d4610ee00 )>",
"<NSLayoutConstraint:0x600001cb3de0 UIInterfaceActionGroupView:0x7f9d4478ceb0.top == _UIContentConstraintsLayoutGuide:0x7f9d4478bba0''.top (active)>",
"<NSLayoutConstraint:0x600001cb3e80 V:[_UIContentConstraintsLayoutGuide:0x7f9d4478bba0'']-(0)-| (active, names: '|':UIInterfaceActionGroupView:0x7f9d4478ceb0 )>",
"<NSLayoutConstraint:0x600001cad090 groupView.actionsSequence....top == _UIContentConstraintsLayoutGuide:0x7f9d4478bba0''.top (active, names: groupView.actionsSequence...:0x7f9d4610ee00 )>",
"<NSLayoutConstraint:0x600001cad130 groupView.actionsSequence....bottom == _UIContentConstraintsLayoutGuide:0x7f9d4478bba0''.bottom (active, names: groupView.actionsSequence...:0x7f9d4610ee00 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600001cd7c50 groupView.actionsSequence....height >= 66 (active, names: groupView.actionsSequence...:0x7f9d4610ee00 )>


this groupView is not a view of mine! I have set translatesAutoresizingMaskIntoConstraints = false on all my custom controls (labels, fields, etc). I presume I need to set that to for the context menu somewhere, but I don't know how or where.

Relevant code:

In my viewcontroller:

Code Block
let interaction = UIContextMenuInteraction(delegate: self)
annotationTypeButton.addInteraction(interaction)

Delegate extension:

Code Block
//MARK: - UIContextMenuInteractionDelegate
extension AnnotationDetailsViewController: UIContextMenuInteractionDelegate {
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
return UIContextMenuConfiguration(identifier: "annotationTypeMenu" as NSCopying, previewProvider: nil) { _ in
let children: [UIMenuElement] = self.makeAnnotationTypeActions()
return UIMenu(title: "", children: children)
}
}
func makeAnnotationTypeActions() -> [UIAction] {
var actions = [UIAction]()
for type in AnnotationType.allCases {
actions.append( UIAction(title: type.rawValue, image: type.image, identifier: nil, attributes: []) { _ in
let annotationType = AnnotationType(rawValue: type.rawValue) ?? AnnotationType.tips
self.annotation.type = annotationType
self.configureAnnotationTypeButton(with: annotationType)
})
}
return actions
}
}

Any help appreciated! On a side note. If I leave a warning like this in, will my app pass and get into the app store?

This is a known issue that has been resolved in iOS 14. It has nothing to do with your code, so you have nothing to worry about!
Thank you! Good to know, has been bugging me for days!
Swift programmatic UI UIContextMenuInteraction Auto layout error (groupView) on opening context menu
 
 
Q