Xcode 8 hangs / unresponsive when opening storyboard

前端 未结 16 1396
南方客
南方客 2021-01-31 17:48

I\'ve recently upgraded to Xcode 8 and updated my project to Swift 3. All worked fine for a little while. Storyboard loading has always been slow (even when still running Xcode

相关标签:
16条回答
  • 2021-01-31 18:05

    In my experience, for an old project, opening with XCode8, it urgently wants to ask you some question about default device to view storyboard with. This question is so critical that until you answer it, you are staring at an invisible dialog window until XCode becomes unresponsive.

    A couple solutions worked for me:

    1. If you get a 1.5 second window of responsiveness when starting XCode - immediately switch to a non-storyboard file. If working with a split pane editor with the storyboard in auxilary panel, toggle it off.
    2. Create another storyboard, open it, XCode will ask you the question about default device.
    3. Answer the question, save the project state and hope to open the storyboard

    Deleting these capabilities allowed me to re-open the storyboard

        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    
    0 讨论(0)
  • 2021-01-31 18:05

    I finally figured out a fix, based in large part on the answers to this question. It finally came down to a stare-and-compare with the XML of a working storyboard, but here's a summary of the steps I took.

    • Reinstall Xcode 8.2.1 and reboot

    • Remove config, state, and data files

      rm -rf ~/Library/Developer/*
      rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
      rm -rf ~/Library/Developer/Xcode/DerivedData/*
      rm -rf ApplicationName.xcodeproj/xcuserdata/
      rm -rf ApplicationName.xcworkspace/xcuserdata/
      rm -rf ~/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState/
      
    • Fix autolayout issues

    • Remove all dependencies from storyboard XML except:

      <dependencies>
          <deployment identifier="iOS"/>
          <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
          <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
      </dependencies>
      
    • Check all storyboards and xib files, ensuring that all "Top Bar" and "Bottom Bar" are set to "Inferred"

    The last two items seemed to be the most important.

    0 讨论(0)
  • 2021-01-31 18:06

    I came across the same problem with one nib in Xcode 8.1.

    Having "Top Bar" and/or "Bottom Bar" set to anything but "Inferred" caused Xcode to slow down to a crawl. Changing this to "Inferred" brings performance back to normal, with the downside that it removes the bars in the preview.

    Incorrect settings

    Correct settings

    0 讨论(0)
  • 2021-01-31 18:08

    I've had this issue multiple times. Usually, Bonan's solution works for me. On the two occasions in which it didn't, the issue seemed to be with a toolbar bar I was using. When I isolated the offending tool bar by panning over to a place on the storyboard where the toolbar's view controller was not visible on my screen anymore, instantly the storyboard speeds back up. I then panned back to the bad view controller and deleted the toolbar before the system slowed down again. I'm sure there's a way to fix the toolbar rather than deleting it, though I don't know what that is. I had the Simulated Metrics value set to 'inferred' as described above by Luke Van In so it must have been a different problem.

    0 讨论(0)
  • 2021-01-31 18:09

    Working with Xcode 8.1 beta. Guess it's a bug in Xcode 8.

    0 讨论(0)
  • 2021-01-31 18:16

    Here is what I did , cut the troubling viewcontroller, paste it in a new temp project's storyboard then paste back the viewcontroller. Working fine for me.

    Over the time, as the storyboard grows, xcode makes a mess of keeping the history track of viewcontroller's elements and hence the freeze.

    0 讨论(0)
提交回复
热议问题