I'm just starting to learn some ios development in Xcode and I am following an online tutorial. It seems though that very regularly my app crashes when I run it and I get the dreaded Signal SIGABRT error.
For example, I have this code:
import UIKit
class ViewController: UIViewController {
@IBAction func camera(_ sender: Any) {
print("hello")
}
func processTimer() {
print("a second has passed!")
}
override func viewDidLoad() {
super.viewDidLoad()
var timer = Timer()
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: Selector("processTimer"), userInfo: nil, repeats: true)
// Do any additional setup after loading the view.
}
}
Now, prior to adding the timer part, the app opened fine. As soon as I added the timer, it creates this crash. The only way I seem to be able to resolve is by deleting the button, but obviously as I start to create proper apps, this will be a real pain.
This same thing has happened a lot to me already where the app works, I add some code and then suddenly I get this error. Could somebody explain what it is I am doing wrong here and how I can fix without deleting the button each time?