我正在创建一个cocoapod sdk,我的podspec文件在这里丢失了我的资产:
s.resource_bundles = {
'Project' => ['Project/Assets/*.xcassets']
}
每当我尝试加载资产时,我也会收到此警告
CUIThemeStore: No theme registered with id=0
我用来访问资产的代码:
image.image = UIImage(named: "Rectangle")
我尝试检查资产文件目标成员身份,并且将其设置为Project-Project
答案 0 :(得分:0)
尝试从自己的捆绑软件中显式访问资产:
final class Project: NSObject {
private static let frameworkBundle = Bundle(for: Project.self)
static let path = frameworkBundle.path(forResource: "Project", ofType: "bundle")!
static let bundle = Bundle(path: path)!
}
extension UIImage {
/// get an image from the project bundle
static func fromPodBundle(_ name: String) -> UIImage? {
return UIImage(named: name, in: Project.bundle, compatibleWith: nil)
}
}
image.image = UIImage.fromPodBundle("Rectangle")