I am trying to make a very simple card game application. While I was building it, I reached to a point where I needed to change the text on a Label. Xcode throws an unexpected error:
Thread1: EXC_BADINSTRUCTION (code=EXC_1386_INVOP, subcode=0x0)
Is there a way to solve that issue?
Thanks for the advice
Code:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var firstCardImageView: UIImageView!
@IBOutlet weak var secondCardImageView: UIImageView!
@IBOutlet weak var playRoundButton: UIButton!
@IBOutlet weak var backgroundImageView: UIImageView!
@IBOutlet weak var Player1CardsLabel: UILabel!
@IBOutlet weak var Player2CardsLabel: UILabel!
var player1Cards:[Int] = []
var player2Cards:[Int] = []
var cardIndex1 = 0
var cardIndex2 = 0
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.playRoundButton.setTitle("Play", forState: UIControlState.Normal)
print(self.playRoundButton.currentTitle)
self.secondCardImageView.image = UIImage(named: "back")
Player1CardsLabel.text = "2" //Here Xcode throws the above error
}