Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Getting a runtime Error with my simple iOS app

Greetings, I created a simple game and the source code compiles just fine, however I'm getting a run-time error with the following errors below:


User uploaded file

User uploaded file

User uploaded file


Being relatively new to Swift and having no prior experience developing iOS applications, I'm a bit lost by what my run-time error actually is.


I thought that the source code looks ok. It's only roughly 30 lines of code.


import UIKit



class Craps: UIViewController {

var rollDice1: Int = 0

var rollDice2: Int = 0

var rollTotal: Int = 0

@IBOutletvar lblRollOne: UILabel!

@IBOutletvar lblRollTwo: UILabel!

@IBOutletvar lblTotalRoll: UILabel!

@IBActionfunc btnRollDice(sender: AnyObject) {

rollDice1 = Int(arc4random() % 6) + 1

rollDice2 = Int(arc4random() % 6) + 1

rollTotal = rollDice1 + rollDice2

lblRollOne.text = String(rollDice1)

lblRollTwo.text = String(rollDice2)

ifrollTotal != 7 || rollTotal != 11 {

lblTotalRoll.text = "Sorry you rolled a \(rollTotal), please try again!"

} else {

lblTotalRoll.text = "Congrats! you rolled a \(rollTotal), play again if you like!"

}

}

}

Can someone please shed some light on the situation. Thanks!

MacBook Pro (Retina, 15-inch, Mid 2014), OS X El Capitan (10.11.3)

Posted on Feb 12, 2016 9:13 PM

Reply
2 replies

Getting a runtime Error with my simple iOS app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.