Reputation: 336
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?
Upvotes: 6
Views: 1332
Reputation: 3908
Great Daniel, Above answer is correct:)
Earlier we had to manually select the Pod target then clean and build but start facing really issue when integrating CI. I spent hours to find out why its creating another target for resoruce_bundle but not for resources (contains custom font). Finally it worked now.
sp.source_files = "POD_PATH/**/*.{swift,xib}","POD_PATH/Font/open-sans/*.{ttf,txt,xib}"
sp.resources = 'POD_PATH/Assets.xcassets'
Upvotes: 2
Reputation: 336
After spending hours trying to figure this out i discovered this was being put in a separate bundle because my spec file was defining
s.resource_bundles = { 'Zapic' => 'Zapic/ZapicAssets.xcassets'}
. This creates a new bundle with just the resources, hence the Zapic-Zapic bundle. Once I changed it to s.resource = 'Zapic/ZapicAssets.xcassets'
everything works as expected. It looks like the CocoaPod docs need to be updated now that dynamic frameworks are supported. I discovered this via an open issue on CocoaPods Github. Hopefully this will save someone else from dealing with the same pain I just went through.
Upvotes: 8