Xcode 7编译错误:“由于信号命令失败:分段故障:11” [英] Xcode 7 compile error : "Command failed due to signal: Segmentation fault: 11"
问题描述
昨天我安装官方的Xcode 7,当我试图打开我的一个Swift项目,出现一个警告,说新的Xcode版本要更新我的swift代码(或类似的东西)。好的,我接受,并在此之后出现命令失败,由于信号:分段错误:11
编译错误(如果你想了解这方面的细节,我可以写整个错误文本)。任何人都有相同的问题?
感谢
已编辑 b
$ b
我安装回Xcode 6.4,没有编译错误。
这是Xcode的一个了不起的错误。只是读这个。 http://blog.bellebethcooper.com/xcode-bug.html
它让我微笑。
这个变化很小,但是这里是什么(在我的API客户端类中,我实际上从API获取JSON数据):
我改变了这一点:
`let json = try ? NSJSONSerialization.JSONObjectWithData(data,options:[])`
到此:
`let json = try? NSJSONSerialization.JSONObjectWithData(data,options:[])as! [String:AnyObject]`
这是我遇到的最令人沮丧的调试之一$ b有,但我希望这篇文章可能会帮助有同样
问题的其他人。如果你通过googling一个错误你结束了,你在努力
,这没有帮助你,我很抱歉。我知道你正在经历什么
。不要放弃!
Yesterday I installed the official Xcode 7 and when I tried to open one of my Swift projects, appeared an alert saying that the new Xcode version wants to update my swift code (or something like this). Okay, I accepted and after this appeared "Command failed due to signal: Segmentation fault: 11"
compile error (if you want details about this, I can write the whole error text). Anyone have the same issue?
Thanks
Edited
I installed back Xcode 6.4 and it's okay, no compilation errors.
Omg, this is a terrific bug of Xcode. Just read this. http://blog.bellebethcooper.com/xcode-bug.html It made me smile.
The change was deceptively small, but here's what it was (inside my API client class, where I actually get the JSON data from the API):
I changed this:
`let json = try? NSJSONSerialization.JSONObjectWithData(data, options: [])`
to this:
`let json = try? NSJSONSerialization.JSONObjectWithData(data, options: []) as! [String: AnyObject]`
This is one of the most frustrating debugging experiences I've ever had, but I hope this post might help someone else who has the same issue. And if you ended up here via googling a bug you're struggling with and this didn't help you, I'm so sorry. I know exactly what you're going through. Don't give up!
这篇关于Xcode 7编译错误:“由于信号命令失败:分段故障:11”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!