[英]xcode 9 crash when open storyboard
打开故事板时,XCode 9 GM Candidate 1正在崩溃。
ProductBuildVersion:9A235
UNCAUGHT EXCEPTION (NSInternalInconsistencyException): Could not find class named UIImage
UserInfo: (null)
Hints:
0: Replacement view is installing: <IBStoryboardCanvasViewController: 0x7fdf6d7f7d70 representing: (null)>
对我来说,在我的应用程序中打开任何故事板或xib时崩溃了。 我创建了一个新的单一视图应用程序项目,没有问题打开它的故事板,重新打开我自己的项目 - 它开始像往常一样打开故事板和xibs。 可能是某种缓存问题..
以下是我遇到的崩溃的详细信息:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Sending _openAs: to <IDEDocumentController: 0x7f944580a970> from <NSMenuItem: 0x7f94249528d0 Interface Builder - Storyboard>
ProductBuildVersion: 9A235
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-13196/InterfaceBuilderKit/IssueProvider/IBIssueProvider.m:72
Details: castedInstance should be an instance inheriting from IBDocument, but it is IDEPegasusSourceEditor.SourceCodeDocument
Object: <IBIssueProvider: 0x7f94366a73d0>
Method: -updatedIssuesForDocument:
我遇到的另一次崩溃,并以相同的方式修复:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Sending openClickedNavigableItemAction: to <IDEStructureNavigator: 0x7ff718acde20 representing: <DVTExtension 0x7ff70acf22e0: Structure Navigator (Xcode.IDEKit.Navigator.Structure) v0.1 from com.apple.dt.IDEKit>> from <IDENavigatorOutlineView: 0x7ff7169ba340>
ProductBuildVersion: 9A235
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-13247/IDEKit/Editor/IDEEditorContext.m:1935
Details: Unexpected document in IDEDocumentController:<IBXIBDocument: 0x7ff6fb013a00>( 0 -[IDEEditorDocument init] (in IDEKit)
我有同样的问题,但在我的情况下,通过删除零键没有解决。 正如Vlad Valentin强调的那样,它与我在Storyboard中的UITabBarViewController
有关。
问题,如Xcode崩溃报告中引发的错误中所述:
UNCAUGHT EXCEPTION (NSInternalInconsistencyException): Could not find class named UIImage
与我分配给tabBar
的背景图像有关。 从Storyboard源代码中删除图像后,我可以再次打开Interface Builder。
去掉:
<tabBar key="tabBar" contentMode="scaleToFill" backgroundImage="Tabbar background" id="W28-zg-YXA">
当我尝试使用Interface Builder重新添加图像时,Xcode抛出了相同的异常。 我已经采用编程方式加载图像。 希望这会有所帮助,并且会节省一些人必须完全重新创建他们的UITabBarViewController
。
我遇到了类似的问题。 在我的情况下,我发现它通过文件浏览器打开时一直崩溃,而通过快速打开( CMD + SHIFT + O )打开不会导致XCode崩溃。
问题是一个零关键标签(至少在我的情况下)
<nil key="simulatedBottomBarMetrics"/>
或更一般地说
<nil key="<generic_name>"/>
这有它的对应物
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
或更一般地说
<<generic_name> key="generic_name"/>
删除所有这些解决了这个问题。
<nil key="simulatedBottomBarMetrics"/>
或任何<nil key="<generic_name>"/>
(将<generic_name>
替换为您的特定标记名称) <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
或任何<< generic_name > key="generic_name"/>
(将<generic_name>
替换为您的特定标记名称) 编辑:
这个标签似乎是相关的,并且在UITabBarController
的Storyboard源代码中 ,但它们的对应物分散在连接到UITabBarController
UIViewControllers
周围。 可以是下面的一个,两个或更多级别。
我为我的案子找到了一个解决方案。 它从UITabBarViewController崩溃了。
正如Michele Schillaci所说,您可以尝试删除一些视图控制器并检查是否解决了问题。
包含系统标签栏项的标签栏存在已知错误。 Xcode 9.1发行说明承认这一点,并建议一个解决方法:
Interface Builder
配置为故事板或xib中的系统项的UITabBarItem会导致构建失败。 (34197132)
解决方法 :在Interface Builder中配置为自定义项,然后将选项卡栏项重置为视图控制器的
awakeFromNib
方法中的所需系统项。
我删除了<nil key ="....">
但它没有用。 所以我试过(来自@Vlad Valentin):
搜索tabBarController
<scene sceneID="RIF-kY-Kwk"> <objects> <tabBarController storyboardIdentifier="mainViewController" id="p5V-Jj-erc" customClass="MainViewController" customModule="yourModule" customModuleProvider="target" sceneMemberID="viewController"> <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="kWD-Cd-EAU"> <rect key="frame" x="0.0" y="0.0" width="375" height="49"/> <autoresizingMask key="autoresizingMask"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </tabBar> <connections> <segue destination="FQU-DF-g8S" kind="relationship" relationship="viewControllers" id="wf7-sS-3aP"/> <segue destination="cVl-bj-mqD" kind="relationship" relationship="viewControllers" id="A5l-iP-1pv"/> <segue destination="yE9-HB-Hqo" kind="relationship" relationship="viewControllers" id="U4m-N7-DeC"/> <segue destination="PmG-7U-DMm" kind="relationship" relationship="viewControllers" id="u4J-Y7-Z51"/> </connections> </tabBarController> <placeholder placeholderIdentifier="IBFirstResponder" id="APY-5z-hrA" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="-3126" y="1236"/> </scene>
storyboardIdentifier="mainViewController"
, customClass="MainViewController"
和<connections>..</connections>
对您很重要。 复制并粘贴它。
scene
。 storyboardIdentifier
, customClass
和connections
。 轻松修复:
只需在<tabBar key="tabBar" contentMode="scaleToFill" id="ytw-4N-0RV">
上insetsLayoutMarginsFromSafeArea="NO"
, <tabBar key="tabBar" contentMode="scaleToFill" id="ytw-4N-0RV">
从故事板源代码中删除所有<nil key ="....">
。
例如:
<tabBarController id="mhN-Gc-eXK" sceneMemberID="viewController" restorationIdentifier="tabbar" storyboardIdentifier="tabbar" customClass="TabbarMainViewController">
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="ytw-4N-0RV">
<rect key="frame" x="0.0" y="0.0" width="320" height="49"/>
我也遇到了这个问题。 当我在我的工作项目的Xcode中单击我的故事板文件时崩溃(彩虹球旋转)。 即使我创建了一个新的单一视图项目,也会发生这种情况。
对我来说,我重启我的Mac Book是一个解决方案。
希望这可以解决你的问题。
我发现以前安装的XCode版本是问题的根源。 我以为我只安装了一个版本但是在右键单击一个XCode项目文件时,我看到在“打开方式......”下,有很多版本。 有旧的beta版XCode 9,以及各种版本的稳定版本甚至XCode 8。
这些版本都不能在我的mac的Applications目录中找到,所以我意识到它们在Downloads目录中处于休眠状态。 我做的是删除所有这些和繁荣,故事板不再冻结XCode 9.3。
我取代了这个
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" backgroundImage="background_tabbar" selectionIndicatorImage="background_tabbar_item" id="Z9r-yE-1Zs">
在那
<tabBar key="tabBar" contentMode="scaleToFill" id="Z9r-yE-1Zs">
当我尝试打开故事板时,Xcode不再崩溃
所以我遇到了一个问题,一旦我在XCode 9中打开一个故事板,文件就被修改了(对于XCode来说并不罕见) - 但是每当我运行带有异常断点的应用程序时,它就会崩溃。 从调试器继续点击允许应用程序正常运行。
看看XCode在故事板文件中修改了什么,它在文件的顶部,在'scenes'xml元素之前,它添加了:
<customFonts key="customFonts">
<array key="GillSans.ttc">
<string>GillSans</string>
<string>GillSans-Light</string>
</array>
</customFonts>
删除它阻止了奇怪的崩溃问题,但是修改故事板会不断添加代码。似乎解决方案是从故事板中删除所有自定义字体并在代码中设置它们 - 或者希望这只是一个奇怪的错误,它将是在稍后的XCode版本中修复。
我遇到了同样的问题:在Xcode 8中创建的故事板将在Xcode 9中挂起。通过逐个导出视图将我的故事板分开(使用编辑器/重构器到Stoyboard - 我不知道的一个功能,直到我是受到这个问题的影响)我发现两个特定的视图导致Xcode挂起。
在这两个视图中,我向UITabBar添加了多个项目 - 左侧的按钮,右侧的灵活空间和按钮。 如果Xcode试图显示它,它会挂起。 如果我看到这些“中毒”视图后我快速点击任何其他故事板,它也会挂起。
因此,解决方案是在Xcode 8中打开项目,从TabBar中删除除一个项目之外的所有项目,删除任何Derived Data文件夹,退出Xcode 8,加载Xcode 9,执行产品/清洁,如果幸运,那么你'我会好的。
尝试打开另一个项目的“.storyboard”,然后回到正在使Xcode崩溃的项目!
Xcode 9.1(9B55)在昨天没问题的项目中遇到了这个问题。 今天当我试图打开任何“.storyboard / .xib”文件时,Xcode崩溃了!
有些人建议我删除所有“ <nil key=...
”标签内容。 它工作,但同时我打开了另一个项目的故事板。 然后我恢复了所有的更改,它再次起作用。
这似乎不是由“ <nil key=...
”标签内容引起的,而是由Xcode变为的一些奇怪状态引起的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.