Reputation: 457
I began programming in swift this week and am trying to make a simple navigation bar in my app. It's not the first time I meet this error and no idea what can be missing. If I'm not mistaken I hook everything from the ui to the code correctrly , but the output says:
libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
What can be the mistake? Thanks
import UIKit
class ViewController: UIViewController {
var t = Timer()
@IBAction func hi(_ sender: Any) {
print("Camera button pressed")
t.invalidate()
}
func processTimer() {
print("1 second has passed")
}
override func viewDidLoad() {
super.viewDidLoad()
t = Timer.scheduledTimer(timeInterval: 1, target: self, selector: Selector(("processTimer")), userInfo: nil, repeats: true)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Upvotes: 2
Views: 6037
Reputation: 327
The problem is with the minus10Button
that is linked to numerous IBActions - some of which didn't exist. So right click on the minus10Button
in the Interface Builder and removed the old and irrelevant links, fixing the problem.
Upvotes: 3