Xcode 8 - IB Designables - Failed to render and update auto layout status, The agent crashed

后端 未结 20 1189
半阙折子戏
半阙折子戏 2020-11-27 09:55

I recently upgraded to Xcode 8 and I am having issues with the Storyboard.

If I open the project and I don\'t have the Storyboard open, it will compile and run just

20条回答
  •  迷失自我
    2020-11-27 10:31

    I had the same issue and came here to try and figure out what happened. I noticed the top rated answer and the answer itself didn't help me, as IBDesignable didn't exist in the log folder and I already attempted all other options there, however in the comments I noticed someone talking about a frame init.

    I decided to try commenting out my IBDesignable extension for UIView and it instantly fixed the problem. So, to fix this, find the extension causing the issue and make sure to set up the required inits by creating an IBDesignable class and providing the required initializers as follows:

    @IBDesignable class RoundedView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        sharedInit()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        sharedInit()
    }
    
    override func prepareForInterfaceBuilder() {
        super.prepareForInterfaceBuilder()
        sharedInit()
    }
    
    func sharedInit() {
    }
    }
    

    IMPORTANT: remember to add the new class to the item you are using the designable on.

提交回复
热议问题