ios - 线程 1 : SIGNAL SIGABRT; What do I do?

标签 ios swift swift3 uialertcontroller

我试图弹出通知,但我不断收到线程 1:SIGNAL SIGABRT 我该怎么办?这是我的代码:

import UIKit
import UserNotifications

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
}
    override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
@IBAction func pushNotification(_ sender: AnyObject) {
    var AlertView = UIAlertController(title: "Time for your call!", message: "Press go to continue", preferredStyle:  UIAlertControllerStyle.alert)
    AlertView.addAction(UIAlertAction(title: "Go", style: UIAlertActionStyle.default, handler: nil))
    self.present(AlertView, animated: true, completion: nil)

}
}

最佳答案

当您为 Storyboard 上的对象创建了一个 socket ,然后出于某种原因决定删除该代码,然后用其他 socket 替换它,而不删除 Storyboard 上的连接时,通常会发生这种类型的错误。结果是编译器寻找您分配给该对象的原始 socket 但找不到它(因为您已删除它!)。

令人高兴的是,解决方案相对较快。转到该对象的连接检查器(它是 XCode 右侧面板中带有指向圆圈的箭头的符号),您可能会发现那里列出的 socket 比您想象的附加到该对象的 socket 要多。删除所有引用您已删除的函数的函数,这应该可以解决您的问题。

关于ios - 线程 1 : SIGNAL SIGABRT; What do I do?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39558319/

相关文章:

xcode - 如何修复 "SWIFT_VERSION ' 3. Xcode 10.2 中的 0' is unsupported, supported versions are: 4.0, 4.2, 5.0"错误?

ios - Xcode,单击按钮转到下一个 View Controller 崩溃

ios - 让 VoiceOver 为 UIKeyInput 播报输入/删除的字符

ios - 使用字符串变量swift调用uilabel动画

swift - 如何在 Swift 中检查 NSDecimalNumber.zero()

swift - 如何在 swift 3 中更改 googlemap 的 myLocationButton 的位置

ios - 为什么 Firebase 数据库 queryEqualToValue 不起作用?

ios - 如何获取按事件来源分配的活跃用户? Google Analytics 事件跟踪 ios

ios - Azure SQL数据库新创建的表不允许插入数据,但所有旧表都允许插入数据

ios - 基于类的 Swift 常量是否强制为可选