cocoapods:资源不会复制到mainBundle(cocoapods: The resources are not copied to mainBundle)

编程入门 行业动态 更新时间:2024-10-25 17:21:26
cocoapods:资源不会复制到mainBundle(cocoapods: The resources are not copied to mainBundle)

我正在努力争取资源。 我希望能够在我的吊舱里放一个nib 。 其中一个类使用此nib 。

这是podspec:

Pod::Spec.new do |s| s.name = "MyCBD_BSManagedDocument" s.requires_arc = true s.osx.platform = :osx, '10.7' s.subspec 'MyCBD_BSManagedDocument' do |ss| ss.source_files = 'Classes/MyCBD_BSManagedDocument/**/*.{h,m}' end s.subspec 'Auxiliary classes' do |ss| ss.subspec 'MyCBDLockManager' do |sss| sss.source_files = 'Classes/Auxiliary classes/MyCBDLockManager/**/*.{h,m}' sss.resource_bundle = {'MyCBDLockManager' => 'Classes/Auxiliary classes/MyCBDLockManager/MyCBDLockManager.xib'} end ss.subspec 'MyCBDSafeguardManager' do |sss| sss.source_files = 'Classes/Auxiliary classes/MyCBDSafeguardManager/**/*.{h,m}' end end end

非常奇怪的是,在我的玩具项目中测试pod,它可以工作(我可以检查nib是在mainBundle ),但是在我的实际项目中,nib不在mainBundle中,我有错误

-[MyCBDLockManager loadWindow]: failed to load window nib file 'MyCBDLockManager'.

关于如何用可可豆荚包含资源的任何建议?

I am struggling with resources. I want to be able to put a nib in my pod. One of the classes uses this nib.

Here is the podspec:

Pod::Spec.new do |s| s.name = "MyCBD_BSManagedDocument" s.requires_arc = true s.osx.platform = :osx, '10.7' s.subspec 'MyCBD_BSManagedDocument' do |ss| ss.source_files = 'Classes/MyCBD_BSManagedDocument/**/*.{h,m}' end s.subspec 'Auxiliary classes' do |ss| ss.subspec 'MyCBDLockManager' do |sss| sss.source_files = 'Classes/Auxiliary classes/MyCBDLockManager/**/*.{h,m}' sss.resource_bundle = {'MyCBDLockManager' => 'Classes/Auxiliary classes/MyCBDLockManager/MyCBDLockManager.xib'} end ss.subspec 'MyCBDSafeguardManager' do |sss| sss.source_files = 'Classes/Auxiliary classes/MyCBDSafeguardManager/**/*.{h,m}' end end end

Very strangely, in my toy-project to test the pod, it works (I can check the nib is in the mainBundle), but in my real project, the nib is not in the mainBundle, and I have the error

-[MyCBDLockManager loadWindow]: failed to load window nib file 'MyCBDLockManager'.

Any advice on how to include resources with cocoa pods?

最满意答案

出于某种原因,构建阶段中的一个阶段缺失。 不过我不知道为什么。 因此,我不得不再次使用pod install添加此阶段。

在此处输入图像描述

For some reason, one phase in the build phases was missing. I don't know why, though. So, I had to add this phase again with pod install.

enter image description here

更多推荐

本文发布于:2023-08-06 12:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1448633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:资源   cocoapods   mainBundle   copied   resources

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!