Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@IBDesignable error: IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool crashed

There are crash reports generated when Interface Builder Cocoa Touch Tool crashes. Theses are located in ~/Library/Logs/DiagnosticReports and named IBDesignablesAgentCocoaTouch_*.crash. In my case they contained a useful stack-trace that identified the issue in my code.


I have had the same issue a couple of times. Both times it started when I was loading an IBDesignable nib onto the storyboard when the nib was not able to fit on the view (ie I had a button off of the UIView but still in the nib). Once I fixed that Xcode still gave me errors so I restarted Xcode until it randomly stopped giving me the error.

I hope this helps.

UPDATE: I just killed all processes named "Interface Builder Cocoa Touch Tool", restarted Xcode and the error went away. Don't know if this will always work or not.


In my case, I was doing the next in the initWithFrame/initWithCoder methods to create the view:

className = NSStringFromClass([self class]);
self.view = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] firstObject];

It looks like I was Not supposed to use the Main Bundle, but instead the bundle of the class. So I replaced that code for the following and it worked:

bundle = [NSBundle bundleForClass:[self class]];
className = NSStringFromClass([self class]);
self.view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];

I thought maybe this might help somebody.


You could select your custom view in Interface Builder and then use Editor, Debug Selected Views. It will launch so-called IBDesignableAgentCocoaTouch debug session when all breakpoints (including exception breakpoints) work and you could exactly identify the place your view crashes.