简体   繁体   中英

Adding header file to Podspec

I'm trying to work out how to add a header file to a specific Podspec. I currently have to manually drag the file into the Pod's group in Xcode to get it to build. Otherwise it complains it cannot find the header file. I'd like to take this step out of the build process. I'm still learning the ins and outs of declaring dependencies in Cocoapods.

The Podspec is as follows:

Pod::Spec.new do |s|
  s.name             = 'ReactNativeCouchbaseLite'
  s.version          = '0.3.0'
  s.summary          = 'couchbase lite binding for react-native'
  s.license          = 'MIT'
  s.platform     = :ios, '7.0'
  s.requires_arc = true
  s.authors      = 'Fraser Xu <xvfeng123@gmail.com>'
  s.homepage     = 'https://github.com/fraserxu/react-native-couchbase-lite.git'
  s.source       = { :git => 'https://github.com/fraserxu/react-native-couchbase-lite.git' }
  s.source_files = 'ios/**/*.{h,m}'
  s.dependency 'couchbase-lite-ios'
  s.dependency 'couchbase-lite-ios/Listener'

  # Current attempt to add the header file
  s.subspec 'CBLRegisterJSViewCompiler' do |ss|
    ss.source_files = 'Extras/CBLRegisterJSViewCompiler.h'
    ss.preserve_paths = 'CouchbaseLite.framework'
    ss.vendored_frameworks = 'CouchbaseLite.framework'
    ss.dependency 'couchbase-lite-ios'
  end
end

The header I need to add is CBLRegisterJSViewCompiler.h . In the release download of couchbase-lite-ios this header appears in the Extras folder.

Try this in your subspec.

ss.public_header_files = 'Extras/CBLRegisterJSViewCompiler.h'

Link back to CocoaPods reference .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM