gpt4 book ai didi

ios - 使用 navigationController 堆栈时难以识别错误

转载 作者:行者123 更新时间:2023-11-30 13:10:37 25 4
gpt4 key购买 nike

描述

所以我决定在清理并重新安装后再次启动我的应用程序,发现我遇到了崩溃,这会将我发送到 AppDelegate.swift 顶部的“线程 1:信号 SIGABRT”文件。当我只是通过显示(推送)到堆栈的按钮浏览 View 时,发生了错误。我什至尝试注释掉我试图达到的 View 上的函数,以确保它不是一个因某种原因抛出错误的函数。下面,我将附加一些与我试图到达的 View 和我当前所在的 View 相关的代码片段。抱歉,如果这看起来很模糊。这只是我遇到的一个非常模糊的问题。

代码

class back4: UIViewController, UITextFieldDelegate{

@IBOutlet weak var no: UIButton!
@IBOutlet weak var yes: UIButton!
@IBOutlet weak var distance: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
/*
@IBAction func save(_ sender: AnyObject) {
let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
let context:NSManagedObjectContext = appDel.managedObjectContext
let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
entity1.crawlerDistance = distance.text

}
@IBAction func yes(_ sender: AnyObject) {
let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
let context:NSManagedObjectContext = appDel.managedObjectContext
let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
entity1.crawlerAbrasion = "yes"
}
@IBAction func no(_ sender: AnyObject) {
let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
let context:NSManagedObjectContext = appDel.managedObjectContext
let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
entity1.crawlerAbrasion = "no"

}
*/
@IBAction func back(_ sender: AnyObject) {
if let navController = self.navigationController {
navController.popViewController(animated: true)
}
}
}
  • ^ 这是我试图通过连接到按钮的显示转场达到的 View 的代码*

    class back3: UIViewController, UITextFieldDelegate{

    override func viewDidLoad() {
    super.viewDidLoad()
    }
    override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    }
    @IBAction func back(_ sender: AnyObject) {
    if let navController = self.navigationController {
    navController.popViewController(animated: true)
    }
    }
    }

^ 这是附加到我当前所在 View 的代码

回顾

同样,除了 AppDelegate.swift 顶部的“Thread 1:signal SIGABRT”之外,我没有收到任何错误消息。我还已经检查过意外的多重分段按钮,因为我知道我过去曾经不小心这样做过。我正在使用 swift 3 和 xcode 8.0

调试器控制台

2016-08-04 10:05:32.239 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied

2016-08-04 10:05:32.241 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"

2016-08-04 10:05:33.732 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied:

2016-08-04 10:05:33.733 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"

2016-08-04 10:05:34.609 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied:

2016-08-04 10:05:34.610 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"

2016-08-04 10:05:35.981 Prototype Inspection[9292:4560823] Unknown class back4 in Interface Builder file.

2016-08-04 10:05:36.010 Prototype Inspection[9292:4560823] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key distance.'

*** First throw call stack:

(0x180a42db0 0x1800a7f80 0x180a42a70 0x18134f6e4 0x185f15de8 0x186078eb0 0x180966888 0x186077898 0x185f19230 0x185cde118 0x185ba08ec 0x185bb90d0 0x185d53e5c 0x185c5fe40 0x185c5fb1c 0x185c5fa84 0x185b9c1e4 0x18352e994 0x1835295d0 0x183529490 0x183528ac0 0x183528820 0x185b9eff4 0x1809f909c 0x1809f8b30 0x1809f6830 0x180920c50 0x182208088 0x185c0a088 0x1000ad4c8 0x1804be8b8)

libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

最佳答案

您导航到的 View Controller 在 Storyboard 中连接了一个 distance 导出,但 distance 属性不存在(或不再存在)在目标 View Controller 的类上。它说找不到 back4 类。确保在 View Controller 的身份检查器中,它在类名称下方设置了正确的模块。有时 Xcode 无法推断出正确的模块,您必须手动设置。

关于ios - 使用 navigationController 堆栈时难以识别错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38770757/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com