Ios 使用Cocoapods 1.0的框架项目中的界面生成器
迁移到Cocoapods 1.0后,使用自定义Ios 使用Cocoapods 1.0的框架项目中的界面生成器,ios,xcode,interface-builder,cocoapods,Ios,Xcode,Interface Builder,Cocoapods,迁移到Cocoapods 1.0后,使用自定义IBDesignable的我的XIB或故事板都无法在动态框架项目上正确呈现。它失败时会出现如下错误: file:///Users/xxxxx/workspace/FooFramework/FooFramework/View.xib: error: IB Designables: Failed to update auto layout status: dlopen(FooFramework.framework, 1): Library not loa
IBDesignable
的我的XIB或故事板都无法在动态框架项目上正确呈现。它失败时会出现如下错误:
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
复制步骤:
Podfile
文件添加任何依赖项。例如:pod安装
并打开.xcworkspace
文件IBDesignable
UIView
子类。例如:但是,项目编译正确,创建的XIB在执行时成功地显示在模拟器中。它仅在Interface Builder上的渲染时间失败 使用Cocoapods 0.38或可执行项目的相同过程按预期工作,不会获得错误,并且正确呈现自定义视图
pod文件中是否缺少任何配置参数?是椰足虫吗?有什么解决办法吗
更新:
尝试使用不同的运行路径搜索路径
和安装目录
,如前所述,但没有成功
找到了使用Cocoapods 0.39的解决方案,该解决方案仍然可以正常工作:
pod _0.39.0_ install
这似乎是由于界面生成器和游乐场不支持默认范围
在修复之前找到的变通方法:
使用pod\u 0.39.0\u安装
返回到0.39
将以下代码添加到pod文件的末尾
:
我正在运行CocoaPods 1.0.1版,考虑到这一点,option#2适合我。非常感谢。
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
}
}
pod _0.39.0_ install
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$PODS_CONFIGURATION_BUILD_DIR'
end
end
end