Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift ElementQuike应用程序-线程1:断点1.4_Swift_Xcode - Fatal编程技术网

Swift ElementQuike应用程序-线程1:断点1.4

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

我正试图使用《应用程序开发与Swift》(来自iBooks)一书构建一个ElementQuike应用程序。当我运行应用程序时,它崩溃并转到AppDelegate页面,并显示一条绿线,上面写着“线程1:断点1.4”

这是ViewController.swift:

// 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
   }
}

这是我的代码。

删除此处的所有连接(参见图片)。只有你有这个连接

很可能是和的副本–只需删除断点,或从调试器菜单中选择“继续”。