2016-08-04 63 views
0

说明遇到问题使用navigationController栈

所以我决定开除我的应用程序,一旦更多的时候,做一个干净并重新安装后,识别错误,并发现我得到的是会送我崩溃到AppDelegate.swift文件顶部的“线程1:信号SIGABRT”。当我只是通过显示(推送)到堆栈上的按钮浏览视图时发生错误。我甚至试着评论我试图达成的观点的功能,以确保它不是由于某种原因抛出错误的函数。下面,我将附加一些代码片断,这些代码片段与我正在尝试访问的视图以及我目前的视图相关联。对不起,如果这看起来模糊。这只是我遇到的一个非常模糊的问题。

代码

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) 
    } 
    } 
} 
  • ^这对于我试图达到视图的代码,通过连接到一个按钮*

    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) 
        } 
        } 
    } 
    
表演SEGUE

^这是附在视图上的代码我目前在

重温

同样,我没有得到任何错误消息除了“主题1:信号SIGABRT”在AppDelegate.swift的顶部。我也已经检查过意外的多段赛车按钮,因为我知道我以前意外地做过这些。我使用迅速3和xcode的8.0

调试器控制台

2016年8月4日10:05:32.239原型检验[9292:4560823] CUICatalog:无效资产名称供给

2016 -08-04 10:05:32.241原型检查[9292:4560823]无法加载标识符为“Wirtgen.Prototype-Inspection”的包中的笔尖引用的图像

2016-08-04 10: 05:33.732原型检验[9292:4560823] CUICatalog:Inval id提供的资产名称:

2016-08-04 10:05:33.733原型检查[9292:4560823]无法加载标识符为“Wirtgen.Prototype-Inspection”的包中的笔尖引用的图像

2016年8月4日10:05:34.609原型检验[9292:4560823] CUICatalog:无效资产名供给:

2016年8月4日10:05:34.610原型检验[9292:4560823]无法加载标签为“Wirtgen.Prototype-Inspection”的包中的笔尖引用的图像

2016-08-04 10:05:35.981 Prototype Inspection [929 2:4560823] Interface Builder文件中的未知类back4。 ***原因检查[9292:4560823] ***由于未捕获异常'NSUnknownKeyException',原因:'[setValue:forUndefinedKey:]:此类不是关键值编码符合关键距离。“

***第一掷调用堆栈:

(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:与类型NSException的未捕获的异常 (LLDB)

终止
+0

调试器控制台说什么? – BaseZen

+0

这些错误可能涉及故事板,因为您没有明确的代码内“推”字段。你能上传整个项目吗? – BaseZen

+0

这调试控制台说:***第一掷调用堆栈: (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:以NSException类型的未捕获异常终止 (lldb) – gavsta707

回答

0

您导航到的视图控制器的故事板中有一个distance插座,但distance属性不会(或不再)在目标视图控制器的类上存在。它说没有back4类可以找到。确保在视图控制器的身份检查器中,它具有设置在类名称下方的正确的模块。有时Xcode无法推断出正确的模块,你必须手动设置它。