Xcode 6.3 freezes/hangs after opening XIB file
Asked Answered
K

10

83

After upgrading to Xcode 6.3 (release version), Xcode now freeze every time I open a XIB/Storyboard file that includes an IB_DESIGNABLE view that uses a custom font for any projects and includes a custom font (not necessarily to have reference to that font in that XIB/Storyboard). The freeze occurs after opening the .xib file and then attempting to switch to any other file. Xcode hangs and must be force quit.

I have opened a bug report with Apple. (Bug 20483867).

Right now, I have two work arounds.

  1. Download and use Xcode 6.2 from Apple.
  2. Remove the IB_DESIGNABLE tags from the custom view header files.

This is likely an Apple bug, but does anyone have a better work around or solution?

Kuehl answered 9/4, 2015 at 17:5 Comment(11)
Same thing here, Xcode freezes completely when I try to switch from Interface Builder to any other file. Removing ALL IB_DESIGNABLE attributes fixes this issue. Will go back to 6.2 fow now...Bookmaker
Same here. Removing the folder ~/Library/Saved Application State/com.apple.dt.Xcode.savedState helps me, but when I try to open storyboard again I got the same issue.Jump
You might also try unchecking "Automatically Refresh Views" to see if this prevents the crash? If so, you could then see if you can "Refresh All Views" without locking up.Shoreward
@Shoreward Where is that setting?Kuehl
@Kuehl https://mcmap.net/q/218166/-ib_designable-ibinspectable-interface-builder-does-not-update It's on the "Editor" drop down menu if you're on an interface builder screen.Shoreward
@Shoreward Good idea, but didn't work. Still hangs.Kuehl
This is so frustrating!Roach
@Shoreward "Automatically Refresh Views" didn't help either.Bookmaker
@Kuehl Can you also post your bug report on OpenRadar? openradar.appspot.comSplash
Apple has requested the output from sysdiagnose. I will keep providing updates as this progresses.Kuehl
Apples has closed my bug as a duplicate. I hope that's a good sign. It also means that I lose visibility to any progress updates. :(Kuehl
N
26

Xcode 6.3.1 fixes the problem with custom fonts and IB_DESIGNABLE views in a Storyboard. Update via the Mac App Store, and you should be good.

Nitrate answered 21/4, 2015 at 19:35 Comment(0)
L
29

I've already suggested an edit for a more accurate description.

It only happens when your project contains a custom font. It'll freeze just by visiting any Storyboard/XIB that contains an IBDesignable custom view, not even referencing to that font in your Storyboard/XIB.

My workaround is to use have an older version of Xcode also installed (Xcode 6.3 beta or Xcode 6.2) and use that to update your Interface Builder files, and never open it in 6.3. open those Storyboard/XIB in a new window in Xcode with option+shift+click the file in the project tree.

Whenever you encounter the freeze, I use this command to clear the saved state just for that project.

rm -rf YourProject.xcodeproj/project.xcworkspace/xcuserdata

Luna answered 10/4, 2015 at 11:4 Comment(3)
the command for clearing xcuserdata is helpful. works for me.Leonor
If you're using CocoaPods, you might also need to remove the xcuserdata from the main workspace file instead of the one from .xcodeproj rm -rf YourProject.xcworkspace/xcuserdataJerroldjerroll
Hey I've been running into this issue a LOT recently so I wrote a script to help deal with the issue. It works great for a project using CocoaPods, but I haven't tested it outside of my own environment. It includes the solution posted in this answer, but should handle both single projects and workspaces gist.github.com/Ziewvater/3190e20b1ace2ab3c3b6. Let me know if there's an improvement I can make on itBackfire
N
26

Xcode 6.3.1 fixes the problem with custom fonts and IB_DESIGNABLE views in a Storyboard. Update via the Mac App Store, and you should be good.

Nitrate answered 21/4, 2015 at 19:35 Comment(0)
K
15

Response from Apple: Link to Developer Forums on Apple

Thank you all for your reports. We are tracking this on our end and working hard to resolve it. Unfortunately we don't have a great workaround, but here are two options to get you going:

If Xcode is hanging on launch because a storyboard/XIB using a custom font/IBDesignable was previously open: remove the "UserInterfaceState.xcuserstate" file inside the xcodeproj of the project you are opening, it would be at a path like this: My App.xcodeproj/project.xcworkspace/xcuserdata/yourusername.xcuserdatad/UserInterfaceState.xcuserstate

If you really need to edit the storyboard/XIB file containing the custom font with Xcode 6.3:

  1. Make a copy of your storyboard/XIB file as a backup
  2. Open the storyboard/XIB file in a text editor
  3. Remove XML tags named "fontDescription" that reference your custom font, for example: . Removing this tag will revert the font to the standard system font.
  4. Make outlets to the objects using the custom font and at runtime set the font of those objects to your custom font, for example in an override of viewDidLoad or awakeFromNib on your view controller

IMPORTANT NOTE: we never recommend hand editing storyboard/XIB files. However we recognize this issue is preventing many of you from editing your documents and wanted to provide a workaround with the caveat that any hand editing may result in corruption of your document.

Kuehl answered 14/4, 2015 at 13:25 Comment(1)
This is all kind of hilarious. "If you really need to edit the storyboard/XIB file"Caustic
B
13

Same problem for me. Removing IB_DESIGNABLE fixes the problem.. Going back to 6.2 doesn't work for me as I'm testing apps on device with iOS 8.3 - Xcode 6.2 can't run apps on devices with iOS 8.3 :(

Budget answered 9/4, 2015 at 22:19 Comment(2)
Same issue here as well. I need 8.3 and I'm also using some newer Swift features.Roach
An alternative if you still need to get work done, and happen to have one knocking around, is to go back to one of the Xcode 6.3 betas. I can confirm that build 6D532l (beta 3 I think) doesn't hang.Respiration
T
3

Another workaround is to change the file extensions to all of your font files and load the changed file names from Info.plist. This way you can keep IBDesignables and still use your custom fonts, but wont be able to see them in the Font Picker in Interface Builder.

All custom fonts that were peviously set from Interface Builder will continue to work, but in order to change them or to set another custom fonts, you will have to do it either from code or to modify the Storyboard or Nib files from text editor in order to set the font name.

Tosspot answered 10/4, 2015 at 13:44 Comment(2)
This worked for me. I found that even after removing the saved state / xcuserdata it would just break again the next time the storyboard was opened. Dropping the extensions for the fonts and updating the Info.plist seems to work betterAtkins
This worked for me as well, after doing the steps that @Kuehl postedTabloid
U
2

I don't have an answer but found out that simply force-quitting and restarting will re-launch Xcode in the exact same situation. To just be able to restart Xcode, remove the folder ~/Library/Saved Application State/com.apple.dt.Xcode.savedState.

Unreflective answered 9/4, 2015 at 17:48 Comment(2)
Another option here is locating your project file in Finder (.xcodeproj or .xcworkspace) -> show package contents -> and remove "xcuserdata" folder there. It will restore your Xcode UI state.Bookmaker
Destroying the User-Data helped me with my Xcode 6.3 issueHearthside
K
1

This bug has been fixed in the 6.4 Xcode beta that came out today. Go to the dev center and log in to download it.

Knurled answered 14/4, 2015 at 6:47 Comment(2)
I would prefer to wait for new release of Xcode 6.3 (e.g. 6.3.1), because we cannot afford to develop on beta releases, because they may bring more issues compared to the ones that are fixed.Tosspot
I have downloaded 6.4 but it still crashes.Keloid
K
1

Xcode 8.1 - if you have a view with Navigation (in my case it was top Bar opaque Navigation Bar), just try to set property "top Bar" to None.

Kabob answered 29/11, 2016 at 15:38 Comment(2)
I think you may have added this to the wrong question.Kuehl
@Kuehl nope, this is actually correct. It was the only thing that worked for me. Please see my answer for more detailsPathe
B
0

As a workaround,I just commented out all the @IBDesignable markup in my handful of custom components that use this. When I did that, yes I lose ability to tweak the settings in Interface Builder, but it allowed me to at least open the .xib files w/out XCode crashing.

I will simply un-comment those @IBDesignable lines when Apple comes up w/ a fix.

Bantu answered 16/4, 2015 at 21:3 Comment(0)
P
0

@O. Kurnenkov's answer worked for me. It didn't have anything to do with IB_Designable nor custom fonts, Cocoapods, etc.

For some reason having an "Opaque Navigation Bar" causes the nib file (it doesn't seem to affect storyboards) to constantly change y position; this can be seen in the Size Inspector where the y position will flicker between 0 and 64. This is happening to me with Xcode 8.2 (8C38).

enter image description here

My guess here is that this causes Xcode to constantly update the layout thus draining resources and causing it to hang/freeze.

enter image description here

The solution is to use any of the "Translucent" options, Inferred, or None.

Hope this helps!

Pathe answered 20/2, 2017 at 7:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.