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.
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
Clear Derived Data . Quit Xcode, Reopen again.
for me it works to close xcode and reopen it again. No errors after. Thanks.
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: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: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.I had this problem in an OS X project.
In my case, the problem was an old project (NMSSH) containing a framework target with bad build settings. Specifically:
INSTALL_PATH
was set to@executable_path/../Frameworks
, but the correct setting is/Library/Frameworks
SKIP_INSTALL
was not set and defaults toNO
, but the correct setting isYES
DYLIB_INSTALL_NAME_BASE
was not set, but the correct setting is@rpath
Note that all of the correct settings are what you get automatically for a newly-created framework target.
After changing the settings to the correct values, Xcode was able to load my
@IBDesignable
view in the storyboard.If you have the same issue building a Mac App, adding
@loader_path/../Frameworks
toRunpath Search Paths
solved this for me.