Nil可选不会在释放崩溃 [英] Nil optional does not crash in Release

查看:229
本文介绍了Nil可选不会在释放崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NSAppDelegate中有以下简单代码

I have the following simple code in NSAppDelegate

func applicationDidFinishLaunching(aNotification: NSNotification) {
  var opt:Int?
  NSLog("\(opt)")
  NSLog("\(opt!)")
  NSLog("done")
}



现在当我在调试模式下运行它时告诉我我们都知道解开nil可选。 当我运行它的发布,它默默退出应用程序,没有任何消息。无控制台日志。没有转储。没有!

Now when I run that in debug mode it tells me what we all know about unwrapping nil optional. But when I run that for release it silently exits the app with no message at all. No console log. No dump. Nothing!

这是怎么回事?

推荐答案

我检查这个错误是否已经用Xcode 6.3 beta 3与Swift 1.2(Build:6D543q)修复。不确定我是否真的想测试另一个测试版: - /然而,我的问题的答案:这是一个错误。

Apple has asked me to check if the bug has been fixed with Xcode 6.3 beta 3 with Swift 1.2 (Build: 6D543q). Not sure if I really want to test another beta :-/ However, the answer to my question: it's a bug.

编辑我自己的阴影和测试与最后beta(4)。问题已修复。

Edit Jumped over my own shadow and tested with the last beta (4). Issue has been fixed.

这篇关于Nil可选不会在释放崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆