Xcode 9.0.1 Interface Builder 100% CPU opening iOS Storyboard

旧城冷巷雨未停 提交于 2019-12-09 15:36:00

问题


Last night Xcode automatically updated to Version 9.0.1 (9A1004). Today, I tried to open an existing project and my iOS storyboard file gets stuck with a never ending spinner and Activity Monitor reports Interface Builder using 100% CPU. I have a second MacBook Pro that still has Xcode 9.0.0 and it opens the storyboard without any issue. I'm running macOS High Sierra on both. Anyone else seen this or know of a workaround.


回答1:


I received a response from my bug report with a suggested workaround. The suggestion was to edit the storyboard text and change the value for the translatesAutoresizingMaskIntoConstraints attribute from NO to YES in the applicable toolbar tags in the storyboard.

From:

<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill"
 fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KCx-9L-amg">

To:

<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill"
 fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="YES" id="KCx-9L-amg">

I have two storyboard files in my project and this does solve the problem with both of them.




回答2:


I FOUND A FIX!! I have been struggling with this for WEEKS and it has been SO frustrating. Tonight I had an epiphany! From what I have noticed and read, the issue seems to be caused by a massive amount of over-building, particularly if you have IBDesignables in your storyboard like I do. So I thought, 'what if I use Apple's new build system they announced this summer?'

In Xcode, go to File > Project Settings. Then change the Build System from "Standard Build System" to "New Build System". Voila! It has been working just like it used to! Hopefully it is not just a temporary fix like some of the others I have seen. So far it seems amazing.

I also am using Xcode 9.0 as an extra precaution that I downloaded from here: https://developer.apple.com/download/more/




回答3:


I have the same problem. I have MacBook Pro and iMac both running High Sierra. Just like you I only upgraded on one of my computers (MacBook Pro). I have tried everything and nothing work. I even reinstalled the OS and copied the old Xcode from the iMac.

Update:
I have found out how to fix it :-) I created a new storyboard and put everything in bit by bit until I found the problematic code. I found out that systemItem="trash" was the problem. Then I went to the original storyboard and deleted systemItem="trash" and everything works!

I also tried to use add and its also failed. So open the src code for the storyboard and search for systemItem.

Any image in Bar Item will get Xcode stuck. I just tried to replace the system item icon with my own trash icon and again ...




回答4:


Use your storyboard Vary Traits concept and set your device in the storyboard to iPhone X.

This is the quick fix in Xcode version 9.1.




回答5:


I just tried Xcode 9.2 Beta 2 (9C34b) and for me its possible to work again :)



来源:https://stackoverflow.com/questions/46922321/xcode-9-0-1-interface-builder-100-cpu-opening-ios-storyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!