I have created a cocoa pod framework that includes some image assets. These assets are included in the pod spec and I can see the image when I inspect the framework, however I'm unable to access it from my app. When I inspect the assets in the "Development Pods" section I noticed that the target is a bundle called Zapic-Zapic instead of the target Zapic. If I change the target membership to just "Zapic" everything works as expected and I can access the image via the bundle. How do I change the target in my framework so that if I don't need to manually change the target?
答案 0 :(得分:2)
花了好几个小时试图解决这个问题之后,我发现这是因为我的spec文件正在定义,所以它被放在一个单独的包中
s.resource_bundles = { 'Zapic' => 'Zapic/ZapicAssets.xcassets'}
。这创建了一个仅包含资源的新捆绑包,因此创建了Zapic-Zapic捆绑包。一旦我将其更改为s.resource = 'Zapic/ZapicAssets.xcassets'
,一切都按预期工作。现在看起来需要更新CocoaPod文档,因为支持动态框架。我是通过CocoaPods Github上的公开问题发现的。希望这会让其他人免于处理我刚刚经历过的同样的痛苦。
答案 1 :(得分:1)
伟大的丹尼尔,以上答案正确:)
之前,我们不得不手动选择Pod目标,然后清理和构建,但是在集成CI时开始面临真正的问题。我花了几个小时来找出为什么它为resoruce_bundle而不是资源(包含自定义字体)创建另一个目标。终于可以了。
sp.source_files = "POD_PATH/**/*.{swift,xib}","POD_PATH/Font/open-sans/*.{ttf,txt,xib}"
sp.resources = 'POD_PATH/Assets.xcassets'