muyoungko
muyoungko

Reputation: 83

cocoa podspec subspec swift compatibility header file not found

Pod lib could not find mymodule-swift.h header.

One of my objc.m file imports following code.

#import <devillogin/devillogin-Swift.h>

Xcode build is success. Everything is ok.

But when I'm trying to distribute with pod, following error printed.

pod lib lint mymodule.podspec

fatal error: 'devillogin/devillogin-Swift.h' file not found

My mylib.podpec is as following

Pod::Spec.new do |s|
...
  s.subspec 'DevilLogin' do |devilLogin|
    devilLogin.source_files = 'devillogin/devillogin/source/**/*.*'
    devilLogin.public_header_files = 'Pod/Headers/*.h'
    devilLogin.dependency 'devil/DevilCore'
    devilLogin.dependency 'KakaoSDK'
  end
end

Is there any syntax in podspec for mylib-swift.h ?

Upvotes: 0

Views: 572

Answers (1)

muyoungko
muyoungko

Reputation: 83

I'm answering to myself.

I found that the issue only occur when it is in the subspec.

No problem with root podspec.

Consequently I couldn't find way to let my pod-subspec import "XXX-swift" header.

But I found workaround.

I referenced firebase frameworks which use many pod-subspecs.

https://github.com/firebase/firebase-ios-sdk

Just watched root pod spect and 1 subspec.

It distributes sub-specs as root pod spec which is success with 'XXX-swift.h' header

And each subspecs depend on it above.

There is Firebase.podspec and FirebaseDynamicLinks.podspec.

FirebaseDynamicLinks is standalone independent frameworks.

But it is actually subspec.

Firebase podspec defines subspec like followings.

This is workaround

s.subspec 'DynamicLinks' do |ss|
    ss.dependency 'Firebase/CoreOnly'
    ss.ios.dependency 'FirebaseDynamicLinks', '~> 7.9.0'
end

It defines DynamicLinks as subspec and define dependency on independent FirebaseDynamicLinks.

Done

Upvotes: 2

Related Questions