简体   繁体   English

XCode 8:展开包装可选值时意外发现nil

[英]XCode 8: Unexpectedly found nil while unwrapping an optional value

Created a new project on XCode 8, installed 1 pod that is of Alamofire and then checked my app if everything is ok, it ran well. 在XCode 8上创建了一个新项目,安装了一个Alamofire ,然后检查了我的应用程序是否一切正常,它运行良好。 And then I hooked up a tableView in the interface builder as I would previously do in earlier versions of XCode, defined the classes, connected the tableviewCell and when I run, the app crashed on my iPhone 5s, being used as my test device. 然后,我像以前在XCode的早期版本中一样,在界面生成器中连接了tableView ,定义了类,连接了tableviewCell,当我运行时,该应用程序在iPhone 5s上崩溃,被用作我的测试设备。 Moreover, there is no error line that I could encounter or shown to the console. 而且,没有错误线可以遇到或显示在控制台上。 Also, I have not force unwrapped any optional. 此外,我还没有强行打开任何可选的包装。 The code crashes before it could reach viewDidLoad() method in the starting viewController. 代码在到达启动viewController中的viewDidLoad()方法之前崩溃。

Set identifier in the Storyboard/xib of the Custom Cell like below: 在自定义单元的情节提要/ xib中设置标识符,如下所示:

在此处输入图片说明

Use same identifier in tableView delegate method cellForRowAtIndexPath : 在tableView委托方法cellForRowAtIndexPath使用相同的标识符:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{

        let cell = tableView.dequeueReusableCellWithIdentifier("TableViewCell") as TableViewCell

        //related code here
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 迅捷的Xcode:解开可选值(lldb)时意外发现nil - swift Xcode: unexpectedly found nil while unwrapping an Optional value (lldb) 展开Optional值时意外发现nil - unexpectedly found nil while unwrapping an Optional value 展开可选的value()时意外找到nil - Unexpectedly found nil while unwrapping an Optional value() 值不是nil,但是在展开Optional值时意外发现nil - value is not nil but getting unexpectedly found nil while unwrapping an Optional value Xcode Swift:appDelgate.window! is nil :致命错误:在解开可选值时意外发现 nil - Xcode Swift : appDelgate.window! is nil : Fatal error: Unexpectedly found nil while unwrapping an Optional value 打开UIViewController时解开Optional值时意外发现nil - Unexpectedly found nil while unwrapping an Optional value while opening UIViewController 展开可选值时意外发现nil,但是有一些值 - unexpectedly found nil while unwrapping optional value, but there is some value xcode9 swift4致命错误:展开一个可选值时意外发现nil - xcode9 swift4 Fatal error: Unexpectedly found nil while unwrapping an Optional value iOS/Xcode:Koloda 框架:在隐式展开 Optional 值时意外发现 nil - iOS/Xcode: Koloda framework: Unexpectedly found nil while implicitly unwrapping an Optional value Xcode控制台错误消息:“致命错误:在展开可选值时意外发现nil”(快速) - Xcode console error message: 'fatal error: unexpectedly found nil while unwrapping an Optional value' (Swift)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM