简单UIContextMenuConfiguration导致无法同时满足约束



我创建了一个简单的ContextMenu

override func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
let configuration = UIContextMenuConfiguration(identifier: nil, previewProvider: nil){ action in
let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash.fill"), identifier: nil,discoverabilityTitle: nil, attributes: .destructive, handler: {action in
self.deleteItem(index: indexPath.item)
})

return UIMenu(title: "", image: nil, identifier: nil, children: [delete])
}

return configuration
}

并在控制台中引发以下警告。

2020-07-16 22:58:16.227394+0200 RunPersonalRecord[8410:2186970] [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. 
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
"<NSAutoresizingMaskLayoutConstraint:0x280eec230 h=--& v=--& UIInterfaceActionGroupView:0x1658ca700.height == 0   (active)>",
"<NSLayoutConstraint:0x280ed7e80 groupView.actionsSequence....height >= 44   (active, names: groupView.actionsSequence...:0x158340200 )>",
"<NSLayoutConstraint:0x280ed4a00 UIInterfaceActionGroupView:0x1658ca700.top == _UIContentConstraintsLayoutGuide:0x157d4dae0''.top   (active)>",
"<NSLayoutConstraint:0x280ed4140 V:[_UIContentConstraintsLayoutGuide:0x157d4dae0'']-(0)-|   (active, names: '|':UIInterfaceActionGroupView:0x1658ca700 )>",
"<NSLayoutConstraint:0x280ed6710 groupView.actionsSequence....top == _UIContentConstraintsLayoutGuide:0x157d4dae0''.top   (active, names: groupView.actionsSequence...:0x158340200 )>",
"<NSLayoutConstraint:0x280ed6760 groupView.actionsSequence....bottom == _UIContentConstraintsLayoutGuide:0x157d4dae0''.bottom   (active, names: groupView.actionsSequence...:0x158340200 )>") Will attempt to recover by breaking constraint <NSLayoutConstraint:0x280ed7e80 groupView.actionsSequence....height >= 44   (active, names: groupView.actionsSequence...:0x158340200 )>

这可能是一个苹果错误,还是有可能以某种方式修复?谢谢

根据苹果论坛的说法,这是一个系统错误。现在我们应该忽略这些警告。对最终用户没有影响。https://developer.apple.com/forums/thread/654647?page=1#621883022

相关内容

  • 没有找到相关文章

最新更新