当我尝试运行名为“线程1:Signal SIGABRT”的Xcode项目时,弹出错误提示

时间:2018-12-26 13:12:40

标签: swift xcode

我正在尝试运行一个单击的简单按钮。但是,当我运行模拟器时,应用程序启动,然后模拟器停止,并弹出错误提示“线程1:Signal SIGABRT”。我对Xcode完全陌生。有人可以帮我吗?

我尝试了链接,但进行了一些研究,但无济于事。

import UIKit
import SpriteKit
import GameplayKit

class GameViewController: UIViewController {

 @IBAction func Button(_ sender: UIButton) {
     print("Hello World!"
}
override func viewDidLoad() {
super.viewDidLoad()



}
}

我希望它打印“ Hello World”,但这没有发生。

4 个答案:

答案 0 :(得分:0)

您创建的插座似乎不再连接到Storyboard子视图。您可以通过右键单击按钮并查看@IBAction是否仍然存在来检查它。

答案 1 :(得分:0)

您可以尝试以下几点:

  • 首先检查您的@IBAction,即您的按钮动作已连接到main.storyboard中的视图控制器
  • 然后在动作函数中放置一个断点,并检查其是否正在执行
  • 通过右键单击插座连接来查看连接,如果显示并放置正确的连接,则查看其是否显示黄色警告标志。
  • -有关以下信息:USE OF BREAKPOINTS

关于断点,请参见以下屏幕截图when you press on your button if its execute then it will pause on the breakpoint with green and if crashed then with red line

Then if you move ahead with arrow down point (above the debug area in left side you will reach to the next line of code, and play the execution again with play button nearby)

答案 2 :(得分:-1)

在main.storyboard中查看,如果带有!的三角形,则在每个项目中都进行第二次单击。里面出现删除该连接。

答案 3 :(得分:-1)

我不明白您是如何进入运行时的,因为xcode在构建阶段开始时抛出错误,原因是未使用)关闭打印语句。