Failed to render instance of IB Designables

前端 未结 15 657
情深已故
情深已故 2020-12-07 12:09

I have an Objective-C and Swift mixed dynamic framework. And the mixed framework was linked with two pure Objective-C dynamic frameworks.

When I tried to mark any cl

相关标签:
15条回答
  • 2020-12-07 12:46

    Follow the below steps:

    1. If there are any conflicts in the storyboard, resolve them correctly, check if the xml is correctly validated.(These is main step.)
    2. Clean the project.
    3. Delete the derived data folder.
    4. Quit Xcode and restart it again. (I had to do this twice.)
    0 讨论(0)
  • 2020-12-07 12:50

    Clear Derived Data . Quit Xcode, Reopen again.

    0 讨论(0)
  • 2020-12-07 12:53

    I also experienced this on a Mac project and Xcode 7.3.1. In my case, the framework referenced in the Failed to Render error message was not related to drawing at all.

    Simply going to the target's General/Linked Frameworks and Libraries tab and changing the offending framework's Status from Required to Optional allowed the IBDesignables to update and draw properly in IB.

    optional status

    0 讨论(0)
  • 2020-12-07 12:53

    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];
    

    But It looks like I was not supposed to use the Main Bundle but 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.

    0 讨论(0)
  • 2020-12-07 12:54

    If you have the same issue building a Mac App, adding @loader_path/../Frameworks to Runpath Search Paths solved this for me.

    0 讨论(0)
  • 2020-12-07 12:54

    I hit this error on a framework containing IBDesignables.

    I had to add $(FRAMEWORK_SEARCH_PATHS) to the LD_RUNPATH_SEARCH_PATHS setting on my framework target.

    After updating the runpath setting, building, and refreshing the view in the storyboard, the error went away. Didn't even have to clean the build folder.

    0 讨论(0)
提交回复
热议问题