从故事板导航到其他 Swift 1.2 文件时,Xcode 6.3 崩溃
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29542356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 6.3 Crashes when navigating from storyboard to other Swift 1.2 file
提问by stone
I installed Xcode 6.3 which includes support for Swift 1.2. It turned up a ton of error messages, which are mostly casting issues.
我安装了 Xcode 6.3,其中包括对 Swift 1.2 的支持。它出现了大量错误消息,主要是铸造问题。
I navigated to the storyboard, and cannot go back to any other .swift
without the whole thing crashing. I have force quit, restarted, and even re-installed, and I still can't navigate away from the Main.storyboard
file.
我导航到故事板,并且不能.swift
在整个事情崩溃的情况下返回到任何其他故事板。我已经强制退出,重新启动,甚至重新安装,但我仍然无法离开该Main.storyboard
文件。
I have tried the suggestion described hereto open storyboard as code, make some changes, revert those changes, save and try again, and still no luck.
我已经尝试过这里描述的建议以代码形式打开故事板,进行一些更改,还原这些更改,保存并重试,但仍然没有运气。
Is something in my code breaking Xcode? Is anyone else experiencing this? I had used Xcode 6.3 beta successfully with the same codebase.
我的代码中有什么东西破坏了 Xcode?有没有其他人遇到过这种情况?我已经使用相同的代码库成功地使用了 Xcode 6.3 beta。
Update:This has now been fixed in Xcode 6.3.1released on the 21st of April 2015.
更新:此问题现已在2015 年 4 月 21 日发布的Xcode 6.3.1 中得到修复。
采纳答案by stone
I gather from the apple developer forums that this is an @IBDesignableissue. Especially in projects that use custom fonts, additional xibs, etc.
我从苹果开发者论坛了解到这是一个@IBDesignable问题。特别是在使用自定义字体、附加 xib 等的项目中。
I have somehow fixed my issue by removing all @IBDesignablefrom swift UIView class definitions. You can open your project directory with TextMate or other, search and remove all "@IBDesignable"
我通过从 swift UIView 类定义中删除所有@IBDesignable以某种方式解决了我的问题。您可以使用 TextMate 或其他打开您的项目目录,搜索并删除所有“@IBDesignable”
However I still think this is a MAJOR bug, that needs to be worked on.. so keep filing bug reports to Apple.
但是我仍然认为这是一个主要的错误,需要解决……所以继续向 Apple 提交错误报告。
回答by Dimitri
A temporary solution:
临时解决方案:
By opening a "New Window"(same project).
通过打开一个“新窗口”(同一个项目)。
One for the code, one for the storyboard orreduce first, work freely with second window.
一个用于代码,一个用于故事板或先减少,在第二个窗口中自由工作。
You can keep your @IBDesignables
你可以保持你的 @IBDesignables
EDIT :Bug fixed -> Update Xcode 6.3.1
编辑:错误修复 -> 更新Xcode 6.3.1
回答by Aaron Brager
Launching Xcode while holding shiftfixed it for me.
在按住的同时启动 Xcodeshift为我修复了它。
(This suppresses Xcode's state restoration.)
(这会抑制 Xcode 的状态恢复。)
Update:Xcode 6.3.1, released today, resolves this issue.
更新:今天发布的 Xcode 6.3.1 解决了这个问题。
回答by Dimitri
回答by Bart?omiej Semańczyk
Temporary solution:
临时解决方案:
If you have currently opened Assistant Editorswitch to another file using alt+click
. You can keep your @IBDesignables
.
如果您当前打开了 Assistant Editor,请使用alt+click
. 你可以保留你的@IBDesignables
.
回答by Anders Forssell
Here's how I get around this strange bug:
这是我如何解决这个奇怪的错误:
- Before launching Xcode, rename the storyboard file in finder so that Xcode won't find it (e.g. add the extension .temp)
- Launch Xcode - works fine even if it hanged before since it cannot display the storyboard editor
- Open a new window in Xcode
- Rename the storyboard file to its original name
- In the new window in Xcode - select the storyboard - Xcode does not hang
- Minimize the new window and work as usual in the original window. Now you canselect any file - even the storyboard - without Xcode hanging
- 在启动 Xcode 之前,在 finder 中重命名故事板文件,以便 Xcode 找不到它(例如添加扩展名 .temp)
- 启动 Xcode - 即使它之前挂起也能正常工作,因为它无法显示故事板编辑器
- 在 Xcode 中打开一个新窗口
- 将故事板文件重命名为其原始名称
- 在Xcode的新窗口中——选择storyboard——Xcode不挂
- 最小化新窗口并在原始窗口中照常工作。现在您可以选择任何文件 - 甚至故事板 - 无需 Xcode 挂起
One problem remains, though, at least for me. Every time I select a file or edit something, Xcode needs to recompile the storyboard. Haven't solved that one yet.
不过,至少对我而言,仍然存在一个问题。每次选择文件或编辑内容时,Xcode 都需要重新编译故事板。还没解决那个。
回答by Andrei Filip
I can confirm this bug. I was stuck in storyboard and could do nothing to get out of it (couldn't even open the assistant). As a workaround, with the storyboard open, right-click the .storyboard
file and select Open As
- Source Code
. This will switch your storyboard to code and you will be able to then switch to any file.
我可以确认这个错误。我被困在故事板中,无法摆脱它(甚至无法打开助手)。解决方法是,在情节提要打开的情况下,右键单击该.storyboard
文件并选择Open As
- Source Code
。这会将您的故事板切换到代码,然后您将能够切换到任何文件。
回答by Bart?omiej Semańczyk
It is not a bug anymore since Apple fixed it in Xcode 6.3.1
.
自从 Apple 在Xcode 6.3.1
.