After migrating to Cocoapods 1.0 none of my XIBs or Storyboards that uses custom IBDesignable
renders correctly on dynamic framework projects. It fails with errors like this:
file:///Users/xxxxx/workspace/FooFramework/FooFramework/View.xib: error: IB Designables: Failed to update auto layout status: dlopen(FooFramework.framework, 1): Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: FooFramework.framework
Reason: image not found
file:///Users/xxxxx/workspace/FooFramework/FooFramework/View.xib: error: IB Designables: Failed to render instance of CustomView: dlopen(FooFramework.framework, 1): Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: FooFramework.framework
Reason: image not found
Steps to reproduce:
- Create a new iOS Framework project.
- Create and add any dependency to the
Podfile
file. For example:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'FooFramework' do
pod 'Alamofire'
end
- Execute
pod install
and open.xcworkspace
file. - Create a custom
IBDesignable
UIView
subclass. For example:
import UIKit
@IBDesignable class CustomView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
layer.cornerRadius = 10
}
required init?(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
layer.cornerRadius = 10
}
}
- Create a new XIB or Storyboard and add the custom view.
At this point XCode will re-compile the code and will be unable to render the custom view. Giving the errors mentioned above.
However, the project compiles correctly, and the XIB created are successfully shown in simulator when executing. It only fails on render time on Interface Builder.
The same procedure using Cocoapods 0.38 or a executable project works as expected, no errors are obtained and the custom view is rendered correctly.
Am I missing any configuration parameter in the Podfile
? Is it a Cocoapods bug? Is there any workaround?
Update:
Tried using different Runpath Search Paths
and Installation Directory
like described here and here with no luck.
Found a workaround using Cocoapods 0.39, that still works with no issue:
pod _0.39.0_ install