【发布时间】:2017-05-03 22:15:34
【问题描述】:
迁移到 Swift 3 后,应用崩溃了
-[_SwiftValue unsignedIntegerValue]: unrecognized selector sent to instance 0x60800064d5f0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue unsignedIntegerValue]: unrecognized selector sent to instance 0x60800064d5f0'
尝试访问vc.view 时。这里是相关代码sn-p。该代码是从UIViewController 调用的。
guard let vc = storyboard?.instantiateViewController(withIdentifier: "some-viewcontroller-id") else {
return
}
if let vc = vc as? SomeViewController {
let theView: UIView = vc.view
theView.translatesAutoresizingMaskIntoConstraints = false
}
如果我在调试窗口中调用let theView: UIView = vc.view 和po vc.view 之前在断点处停止,我会在调试窗口中得到相同的错误。
-[_SwiftValue unsignedIntegerValue]: unrecognized selector sent to instance
但是如果我再次po vc.view 我得到... 瞧...
Optional<UIView>
然后可以继续执行。我正在使用 Xcode 8.1。在 iOS 设备和模拟器上重现。
有什么建议吗?
【问题讨论】:
-
只是为了确定-您是否尝试过通常的方法-清理、清理构建文件夹、清除派生数据、重置模拟器(这是在模拟器上还是在设备上发生)、重新启动 Xcode?哪个版本的 Xcode?span>
-
@Losiowaty。我正在使用 Xcode 8.2。在设备和模拟器上重现。是的,我照常尝试了。
标签: ios uiviewcontroller swift3