Failed to render instance of IB Designables

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 class in the mixed framework with IB Designable and using that class in either storyboard or nib, the Xcode always says the instance of it was failed to render.

And there was the error message:

IB Designables: Failed to render instance of WZUITokenField: dlopen(WZUIKit.framework, 1): Library not loaded: /Library/Frameworks/WZFoundation.framework/WZFoundation Referenced from: WZUIKit.framework Reason: image not found

IB Designables: Failed to update auto layout status: dlopen(WZUIKit.framework, 1): Library not loaded: @rpath/WZFoundation.framework/WZFoundation Referenced from: WZUIKit.framework Reason: image not found

The framework WZUIKit is an Objective-C and Swift mixed framework and the WZFoundation is pure Objective-C.

Plus, all these sutff work on either device or the simulator.


Finally, I solved this issue by adding $(CONFIGURATION_BUILD_DIR) in the target's build settings' Runpath Search Paths field.

Plus, there are some additional steps you might need to do with your Xcode.

  1. Clear Xcode derived data for the project. They are in ~/Library/Developer/Xcode/DerivedData
  2. Clean your current build by pressing K
  3. Build your project
  4. In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed and errors should be gone

Credit to @Mojtaba


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


for me it works to close xcode and reopen it again. No errors after. Thanks.


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.

enter image description here


Interesting.

First, WeZZard's answer got me going in the right direction but wasn't exactly my solution.

In my iOS project, something had overridden the Runpath Search Paths field in my target. It looked like this:

LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

I tried his solution of adding the $(CONFIGURATION_BUILD_DIR) but it didn't work for me. Since it wasn't working, out of habit I just deleted the configuration entry (going back to project defaults). When I did, it reset to this:

LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'

which if I dig into my xcconfig files, appears to come from the Cocoapods.

It seems same as Alex that the @loader_path is key, but it's a slightly different path on iOS than it is Mac OS X.