@IBDesignable crashing agent
Xcode's Interface Builder requires that you implement both or neither initializers for @IBDesignable
classes to render properly in IB.
If you implement required init(coder aDecoder: NSCoder)
you'll need to override init(frame: CGRect)
as well, otherwise "the agent will crash" as seen in the errors thrown by Xcode.
To do so add the following code to your class:
override init(frame: CGRect) {
super.init(frame: frame)
}
I've met the same problem and solved it this way:
- The Problem:
error: IB Designables: Failed to update auto layout status: The agent crashed
- Find the debug button in the inspection file and click it.
Then the Xcode will tell you where the prolem is. In my case I drop the
IBDesignable
before the class.Then I clean and rebuild it, the error disappeared
In Xcode 7.3, none of the above solutions worked for me, but the accepted answer to this question did: Failed to render instance of IB Designables
- Clear Xcode derived data for the project. They are in ~/Library/Developer/Xcode/DerivedData
- Clean your current build by pressing ⌘⇧K
- Build your project
- In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed and errors should be gone
I did not need to do the 4th step to solve the problem (and get my PaintCode-drawRect'd UIView to paint in the storyboard), included here just in case.
Credit to @Mojtaba and @WeZZard
There are a myriad of problems that can cause this. Fire up Console, and look for the crash report IBDesignablesCocoaTouch...
I just sorted out a problem with a 3rd party designable which had issues with the valueForKey
semantics.