Swift ElementQuike应用程序-线程1:断点1.4
我正试图使用《应用程序开发与Swift》(来自iBooks)一书构建一个ElementQuike应用程序。当我运行应用程序时,它崩溃并转到AppDelegate页面,并显示一条绿线,上面写着“线程1:断点1.4” 这是ViewController.swift:Swift ElementQuike应用程序-线程1:断点1.4,swift,xcode,Swift,Xcode,我正试图使用《应用程序开发与Swift》(来自iBooks)一书构建一个ElementQuike应用程序。当我运行应用程序时,它崩溃并转到AppDelegate页面,并显示一条绿线,上面写着“线程1:断点1.4” 这是ViewController.swift: // ViewController.swift // ElementQuiz import UIKit class ViewController: UIViewController { override func viewDi
// ViewController.swift
// ElementQuiz
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
updateElement()
}
@IBOutlet weak var image view: UIImageView!
@IBOutlet weak var answerLabel: UILabel!
@IBAction func showAnswer(_sender: Any) {
answerLabel.text = elementList[currentElementIndex]
}
@IBAction func gotoNextElement(_sender: Any) {
currentElementIndex += 1
if currentElementIndex >= elementList.count {
currentElementIndex = 0
}
updateElement()
}
let elementList = ["Carbon", "Gold", "Chlorine", "Sodium"]
var currentElementIndex = 0
func updateElement() {
answerLabel.text = "?"
let elementName = elementList[currentElementIndex]
let image = UIImage(named: elementName)
imageView.image = image
}
}
下面是AppDelegate.swift:
//AppDelegate.swift
//ElementQuiz
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// This is the line with the "signal SIGABRT" error.
var window: UIWindow?
func application(_application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//Override point for customization after application launch.
return true
}
}
这是我的代码。删除此处的所有连接(参见图片)。只有你有这个连接 很可能是和的副本–只需删除断点,或从调试器菜单中选择“继续”。