Reputation: 3283
We have been having tremendous problems with Xcode 10's interface builder for iOS over the past few months.
The issues only occur after some editing operations. An xcode re-start is needed to make them go away. In some cases they go away when switching between different device sizes in the storyboard.
Issues encountered:
Xcode crashes unexpectedly while editing storyboard.
Constraints stop updating. Constraint warnings stop updating. (No option to click the yellow warning button - update constraints).
"A small gray square" is displayed instead of my view / view controller. No views are rendered. Just a blank gray view.
No subviews being rendered on controller - just a gray background.
An error shown saying Interface Builder has crashed, asking to view the logs. Actually viewing the XCode logs - makes no sense, because it's alien language...
We have found a workaround, however!!
We close the project, and the workspace. And we open the storyboard by itself, in XCode. (outside the project).
So all you need to do is: make sure you set up the IBOutlets and IBActions that you need through the project, and then to work on the layout adjustments, just open the storyboard stand-alone, with the project closed.
But now this poses a question: Some settings in the project are obviously causing issues with interface builder and editing of storyboards. How can I diagnose the problem further, and figure out what project issues are causing Interface builder to fail?
Some more background info:
We have a framework reference inside our project, with it's own Bundle ID. It has a lot of storyboards. It's referenced to the app project as a sub-project reference.
There is no workspace. Only projects being used. (No cocoapods being used)
Our storyboards are tiny: one controller per storyboard only. All navigation is managed through code. (no segues). So complexity of storyboard is not the problem.
We don't use IBDesignables or any advanced features.
We just use constraints. Trait variations are ON by default on all storyboards, but we don't use them.
We reference other .framework files from our own framework. Some of these are fat frameworks.
Upvotes: 0
Views: 778
Reputation: 1184
I had a similar issue when switching Interface Builder from any iPhone device to any iPad device - Xcode 10 just crashed. Switching among iPhone devices was fine.
Turns out the log indicated a problem with 'setAttributeText' on a UILabel. One of my UILabels that is set to Attributed (vs. plain) had the alignment set to Align Natural "---". Setting it to Align Center fixed the crash problem and switching to iPad devices now works Ok again.
Upvotes: 1
Reputation: 110
Sometimes this is due to an @IBDesignable on the storyboard/xib that you are working. Try focusing on the @IBDesignable view and to go Editor->Debug Selected Views and follow the stack trace output. Often times it will give you enough insight to continue debugging and figure out what exactly is causing the problem.
For our project it's the @IBDesignable class trying to use something that's not initialized until runtime and and assertion failure occured hence the error.
Upvotes: 1
Reputation: 607
Have same problems for old projects created in Xcode 7 or 8. My solution was to delete all VC views and create again
Upvotes: 0