I am new to Swift, and I am trying to develop a quiz app. When I try to load the app on my iPhone, i get this error of SIGABRT in the AppDelegate class, and then there is just a white screen on the phone. How can I fix this? I have already tried to clean the code, and I erased and checked carefully the links that i have between the buttons and the code (as suggested in another question with those answers), and I still get this error.
below is my view class
import UIKit
import Foundation
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
updateQuestion()
}
//Label
@IBOutlet weak var label: UILabel!
@IBOutlet weak var scorelabel: UILabel!
@IBOutlet weak var flagview: UIImageView!
//Botones
@IBOutlet var botona: UIButton!
@IBOutlet var botonb: UIButton!
@IBOutlet var botonc: UIButton!
@IBOutlet var botond: UIButton!
let allQuestions = QuestionBank()
var questionNumber: Int = 0
var score: Int = 0
var selectedAnswer: Int = 0
//Button
@IBAction func boton(_ sender: UIButton) {
if sender.tag == selectedAnswer {
print("Correcto")
score+=1
}
else {
print("Incorrecto")
}
updateQuestion()
}
func updateQuestion(){
flagview.image=UIImage(named:allQuestions.list[questionNumber].questionImage)
label.text=allQuestions.list[questionNumber].question
botona.setTitle(allQuestions.list[questionNumber].optionA, for: UIControlState.normal)
botonb.setTitle(allQuestions.list[questionNumber].optionB, for: UIControlState.normal)
botonc.setTitle(allQuestions.list[questionNumber].optionC, for: UIControlState.normal)
botond.setTitle(allQuestions.list[questionNumber].optionD, for: UIControlState.normal)
selectedAnswer = allQuestions.list[questionNumber].correctAnswer
questionNumber += 1
}
func updateUI(){
}
func restartQuiz(){
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
Any help would REALLY be appreciated! Thank you in advance.