Ios 点击UITextField时出现运行时错误

Ios 点击UITextField时出现运行时错误,ios,swift,Ios,Swift,每当我点击文本字段时,我都会遇到一个错误。我不能理解它的意思。当用户点击TextField字段时,我尝试加载viewController时会发生这种情况 func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { if textField == self.location { let vc = RquestDetailViewController()

每当我点击文本字段时,我都会遇到一个错误。我不能理解它的意思。当用户点击TextField字段时,我尝试加载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

属性,Arg[1]=[传播的闭包:从@callee_owned(@unowned Swift.UnsafeBufferPointer)->()到@callee_owned(@unowned Swift.UnsafeBufferPointer)->(@out()),参数类型:[@callee_owned(@unowned Swift.UnsafeBufferPointer)->]>Swift.StaticString.withUTF8Buffer的泛型专门化

函数
textfield shouldbeginediting
用于在编辑之前检查前提条件。您将其用于视图更改时出错。这可能会导致textfield委托流中出现一些内部运行时错误


尝试使用
ui按钮
ui标签和UIAPTgestureRecognitizer

点击文本字段时,您想做什么?是self。location是UITextField类型的吗?您使用的是故事板吗?我猜您的问题不在这个委托方法中。您试图显示的是视图控制器。我可以在中这样做吗textfield didbeginediting,但我将textfield的输入视图设置为零。我认为textfield ShouldBeginediting也很好。这是你的选择,但我不想使用你的代码;)-从调用方的角度查看它。我问你“我可以输入文本吗?”而不是告诉我是或不是,你做了一些完全出乎我意料的事情。是的。这可能是一个坏的用户体验。但从技术角度来看,它完全可以。