xcode 9 crash when open storyboard

前端 未结 14 1989
说谎
说谎 2020-12-09 15:05

XCode 9 GM Candidate 1 is currently crashing when opening a storyboard.

ProductBuildVersion: 9A235

UNCAUGHT EXCEPTION (NSInternalInconsistencyExcepti         


        
相关标签:
14条回答
  • 2020-12-09 15:38

    For me it was crashing on opening any storyboard or xib in my app. I have created a new single view app project, opened its storyboard without a problem, reopened my own project - and it started opening storyboards and xibs as usual. Probably a caching issue of some sort..

    Here are the details of a crash I was experiencing:

    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:
    

    Another crash that I have experienced, and that got fixed the same way:

    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)
    
    0 讨论(0)
  • 2020-12-09 15:38

    I was having the same issue: a storyboard created in Xcode 8 would hang in Xcode 9. After taking my Storyboard apart by exporting the views one by one (using Editor / Refactor to Stoyboard - a feature I didn't know existed until I was struck by this issue) I found that two specific views were causing Xcode to hang.

    In both these views, I had added more than one item to a UITabBar - a button on the left, a flexible space and a button on the right. If Xcode tried to display this, it would hang. If I quickly clicked to any other Storyboard once these "poisoned" views were seen, it would also hang.

    The solution is therefore to open the project in Xcode 8, remove all but one item from the TabBar, delete any Derived Data folders, quit Xcode 8, load Xcode 9, do a Product / Clean, and if you're lucky, you'll be good to go.

    0 讨论(0)
  • 2020-12-09 15:39

    I got this problem too. Crash(rainbow ball rotating) when I click my storyboard file in Xcode of my working project. It's happened even if I create a new single view project.

    For me, I restart my Mac Book to be a workaround solution.

    Hope this can fix ur problem.

    0 讨论(0)
  • 2020-12-09 15:42

    I had the same issue, but in my case it was not solved by removing nil keys. As highlighted by Vlad Valentin, it was related to a UITabBarViewController I had in my Storyboard.

    The issue, as stated in the error thrown in the Xcode crash report:

    UNCAUGHT EXCEPTION (NSInternalInconsistencyException): Could not find class named UIImage
    

    related to a background image I had assigned to the tabBar. Once I removed the image from the Storyboard source code, I could then open Interface Builder again.

    Remove:

    <tabBar key="tabBar" contentMode="scaleToFill" backgroundImage="Tabbar background" id="W28-zg-YXA">
    

    When I tried re-adding the image using Interface Builder, Xcode threw the same exception. I have resorted to loading the image programmatically. Hope this helps, and will save some people having to fully re-create their UITabBarViewController's.

    0 讨论(0)
  • 2020-12-09 15:44

    The issue is a nil key tag (at least for my case)

    <nil key="simulatedBottomBarMetrics"/>

    or more generally

    <nil key="<generic_name>"/>

    That has its counterpart

    <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>

    or more generally

    <<generic_name> key="generic_name"/>

    Removing all of them solves the issue.

    1. Open the storyboard as Source Code
    2. Search and remove: <nil key="simulatedBottomBarMetrics"/> or any <nil key="<generic_name>"/>(replace <generic_name> with your particular tag name)
    3. Search and remove their counter part: <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> or any << generic_name > key="generic_name"/> (replace <generic_name> with your particular tag name)
    4. Save and open your storyboard normally
    5. Enjoy

    EDIT:

    This tags seems to be related and are in the Storyboard Source Code of UITabBarControllers however their counterparts are scattered around UIViewControllers connected to the UITabBarController. Can be one, two or more levels below.

    0 讨论(0)
  • 2020-12-09 15:44

    I removed <nil key ="...."> but it didn't work. So i tried that (From @Vlad Valentin):

    1. Open the storyboard as source code.
    2. Search for 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>
      
    3. storyboardIdentifier="mainViewController", customClass="MainViewController" and <connections>..</connections> are important for you. Copy and paste it.

    4. Remove scene.
    5. Now you can open storyboard with Interface Builder.
    6. Add Tab Bar Controller (Drag Drop and remove child view controller.)
    7. Go Stroyboard source code and paste storyboardIdentifier, customClass and connections.
    0 讨论(0)
提交回复
热议问题