-3

why is my app crashing when I am booting it, yet there not any code inputted to cause anything?

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let tap: UITapGestureRecognizer = UITapGestureRecognizer (target: self, action: #selector(ViewController.keyvoardDismiss))

        view.addGestureRecognizer(tap)
    }

    @objc func keyvoardDismiss() {
        view.endEditing(true)
    }

}
Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
  • 1
    try `#selector(self.keyvoardDismiss)` – Scriptable Feb 12 '19 at 14:56
  • 4
    Xcode is an IDE, not a programming language. I'm pretty sure Xcode, the IDE doesn't crash, but your app does (if it was Xcode crashing, you should submit a bug report to Apple). You should also [edit] your question to include the error message from the crash report, which Xcode does provide. You should also have a look at [How can I deal with @objc inference deprecation with #selector() in Swift 4?](https://stackoverflow.com/questions/44390378/how-can-i-deal-with-objc-inference-deprecation-with-selector-in-swift-4) and [this Q&A](https://stackoverflow.com/questions/24007650/selector-in-swift). – Dávid Pásztor Feb 12 '19 at 14:59
  • In latest Xcode , there is no error in calling `keyvoardDismiss`. The error code is from `view.endEditing(true)`. What does that mean? – E.Coms Feb 12 '19 at 15:11
  • I wonder in what language does keyboard translate to keyvoard. I googled it and there are 16K results vs. billions of "keyboard" results. Or is just a typo that made my curiosity spin? – eharo2 Feb 12 '19 at 19:51

1 Answers1

2

keyvoardDismiss is not a class method, use

#selector(keyvoardDismiss)