每当我点击文本字段时都会遇到错误。我无法理解其含义。当我尝试在用户点击文本字段时加载viewController时会发生这种情况。
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
if textField == self.location {
let vc = RquestDetailViewController()
self.show(vc, sender: nil)
}
return false
}
错误
attribute, Arg[1] = [Closure Propagated : reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> () to @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@out ()), Argument Types : [@callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> ()]> of generic specialization <preserving fragile attribute, ()> of Swift.StaticString.withUTF8Buffer <A> ((Swift.UnsafeBufferPointer<Swift.UInt8>) -> A) -> A
-> 0x102358014 <+120>: brk #0x1
答案 0 :(得分:1)
函数textFieldShouldBeginEditing
用于在编辑之前检查前提条件。你错过了它的视图变化。这可能会导致textfield委托流中出现一些内部运行时错误。
尝试改为使用UIButton
或UILabel & UITapGestureRecognizer
。