Xcode crashes when I set an aspect ratio in XIB

Whenever I try to set an aspect ration between two elements (e.g. parent UIView with child UIImageView) by pressing ctrl and dragging from one to the other, then picking "Aspect Ratio" in the new popup list, Xcode crashes.

Sometimes I can see the new constraint for a second in the inspector before the crash happens and it says:

(null) Ratio to: Img View

Already sent 2 bug reports, no point sending any more than that. I'm using Xcode 12.5, I know a new version is out but it won't let me install it because apparently there isn't enough space left (there are 18gb!)...

This now also bricked my main storyboard and I can't open it with the IB anymore:

The document "Main.storyboard" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)

I made several tests in Xcode 13RC and never got a crash.

I tested also in 12.4 and 12.5, never got a crash either.

Do you get something like this in Size Inspector ?

here isn't enough space left (there are 18gb!)...

Yes, you need 60 GB or more to install newer version of Xcode.

This now also bricked my main storyboard and I can't open it with the IB anymore

What you could try is search for your Main.storyboard in Finder, then open with a simple text editor.

You will see the xml code. There you may look for what could be broken.

If you have saved an older version of your app, (which is a good practice), compare the 2 xml files to search for difference.

You should find an extra line like this:

    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>

in the part

    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pTr-qg-2gq">
       <rect key="frame" x="87" y="233" width="240" height="128"/>
       <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  </imageView>

Try to remove it. (work on a copy of the complete app folder to do such a try.

Wish you good luck.

it says "Null".

  • Could you explain exactly how you defined the ratio, between which components in the view ?
  • I did connect from the ImageView to the View.
  • Looks like you try to connect to an element of zero size, hence a zero div, hence the null ?
  • Did you connect from View to ImageView ?

60gb? That better be a joke.

Unfortunately, not: 11 GB, then uncompress add another 30 GB. Then install…

If I remember correctly, when I tried with 40 GB available led to a refusal to install…

I didn't set the ratio myself but just dragged one element to the other (tried both ways), while holding down ctrl, then picked "Aspect Ratio" in the dropdown list - no idea how to do it any other way. The UIImageView is a child of the UIView and they both have their "spaces" set to their own superview in the size inspector. The most outer element is a UITableViewCell and I wanted to make IB (it was complaining about a missing constraint) happy by setting the full size like that. Even if there was a zero division, it shouldn't crash but give some type of error message.

After the new OS version was done installing I ended up with around 35gb but it was still complaining about not enough free space. I deleted two old SDKs for versions I'd never been using (why is it even keeping/installing that stuff in the first place), which got me to around 43gb and it finally worked. If I'd stopped the download (took the whole day, downloads from Apple's servers are always so slow!), I probably wouldn't have been able to start it again because of the space problem, which happened to me before. I had to call Apple and they helped me clear some cached data. They really have to find a better way to do this, it's a problem every single time and this machine isn't even used for anything else apart from Xcode!

When I started it up just now (oh yay, they changed a couple of icons, so worth it!) a new error showed up for 3 of my UIViewControllers:

Failed to render and update auto layout status for ViewController.... (ID): Agent crashed

Great, I got the same error before the storyboard broke but atm I'm using the old backup one.

Xcode crashes when I set an aspect ratio in XIB
 
 
Q