Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

If that phase is missing you should try to run pod install again and make sure you're opening the xcworkspace that is generated. Also you want just resources not resource_bundles for a single xib like that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top