这一问题表明,它与等级有关,我是新的斯威夫特4和谷歌地图。
从容器关闭面板时在dropView.topAnchor.constraint(equalTo: self.bottomAnchor).isActive = true上发出。
override func didMoveToSuperview() {
self.superview?.addSubview(dropView)
self.superview?.bringSubview(toFront: dropView)
dropView.topAnchor.constraint(equalTo: self.bottomAnchor).isActive = true // Having issue here for bottom anchor when closing the UIViewController
dropView.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
dropView.widthAnchor.constraint(equalTo: self.widthAnchor).isActive = true
height = dropView.heightAnchor.constraint(equalToConstant: 0)
}这是容器关闭的代码。
isHidden = !isHidden
animateStatusBar()
hideGrayCoverView()
animateCenterPanelYPosition(targetPosition: 0) { (finished) in
if finished {
self.currentState = .collapsed
if let mapSettings = self.mapFilterSettingsVC {
mapSettings.view.removeFromSuperview()
mapSettings.removeFromParentViewController()
}
self.mapFilterSettingsVC = nil
}
}误差栈
在UIViewAlertForUnsatisfiableConstraints上设置一个符号断点,以便在调试器中捕捉到这一点。中列出的UIConstraintBasedLayoutDebugging类别中的UIView方法也可能有所帮助。2018-07-24 10:18:30.890527+0800 peasus3510:65686 TIC读取状态3:0x0: 1:57 2018-07-24 10:18:30.890651+0800 Pegasus3510 3510:65686 TIC读取状态3:0x0: 1:57 2018-07-24 10:18:31.017810+0800 Pegasus3510 3510:65443 Google for iOS和Google for iOS版本: 2.7.30514.0 2018-07-24 10:18:34.211751+0800 Pegasus3510 3510:65443*,终止应用程序是由于未提示的异常“NSGenericException”,原因:“不能用锚激活约束,因为它们没有共同的祖先。约束或其锚点是否引用不同视图层次结构中的项?那是非法的。“
发布于 2018-07-24 03:09:59
我设法通过删除mapSettings.removeFromParentViewController()来修复它。
我认为这对我来说是有意义的,因为在从容器视图(处理所有控制器的另一个UIViewController )关闭整个UIViewController时,您正在尝试删除它。
https://stackoverflow.com/questions/51489598
复制相似问题