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.
In my case, I was doing the next in the initWithFrame/initWithCoder methods to create the view:
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:
I thought maybe this might help somebody.
I hit this error on a framework containing IBDesignables.
I had to add
$(FRAMEWORK_SEARCH_PATHS)
to theLD_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.
I had same problem In Xcode 6.4, adding Test target membership to the storyboard fixed these errors for me.
Also my test target has
@loader_path/Frameworks
set inRunpath Search Paths
for test target, and not in original target.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.
~/Library/Developer/Xcode/DerivedData
Editor
menu and doRefresh All Views
; wait for build to be completed and errors should be goneCredit to @Mojtaba
I had a similar error which was caused by my Framework's views not having public initialisers:
I just figured out another reason in my case:
When I used 'Editor -> Debug Selected Views' I saw that it crashed, because I was using CoreGraphics to create an image and use it as background image for a button:
The reason is simply that size is (0.0, 0.0). Why is that? I am calling
But in IB self.bounds.size is still 0 at this point! So I changed one line:
And now it works :)
Apple should provide a list with Dos and Don'ts regarding the IB...