8
在swift 3转换后,我得到这个错误。swift 3错误[_SwiftValue nsli_superitem]
'NSInvalidArgumentException' 的,理由是: ' - [_ SwiftValue nsli_superitem]:无法识别的选择发送到实例0x600000a54820'
有问题的代码是这样的,用它来很好地工作SWIFT 2:
let views = ["newView": userLabel]
let widthConstraints = NSLayoutConstraint.constraints(withVisualFormat: "H:[newView(0)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
userMainLabel.addConstraints(widthConstraints)
在我的情况下,我的视图被声明为可选的,但似乎在Swift 2中编译器隐式解开了那个。我喜欢这个。更可预测。谨慎选择字典中的可选项!呵呵 – SeizeTheDay
谢谢。我想了一天之前浪费了:( – Storix