3

I'm trying to build a private cocoapod for my Cocoa Touch Framework (swift version 4.0), that has a dependency on React-Native v0.46.4 and Yoga, using this podspec:

react_native_version = '0.46.4'

Pod::Spec.new do |s|
  s.name             = 'MyLibrary'
  s.version          = '0.1.0'

  s.source           = { :git => 'https://github.com/mylibrary.git', :tag => s.version.to_s,
                         :git => 'https://github.com/facebook/react-native.git', :tag => "v#{react_native_version}"
                       }

  s.platform       = :ios, '11.0'
  s.requires_arc   = true

  s.source_files        = 'MyLibrary/Classes/**/*.swift'
  s.resources           = 'MyLibrary/Assets/*.{png,storyboard}'
  s.public_header_files = 'MyLibrary/Classes/**/*.h'

  s.frameworks = 'UIKit', 'ARKit', 'SceneKit', 'SpriteKit'

  s.dependency 'ADAL', '~> 2.2'

  s.dependency 'Yoga', "#{react_native_version}.React"
  s.dependency 'React/Core', react_native_version
  s.dependency 'React/BatchedBridge', react_native_version
  s.dependency 'React/DevSupport', react_native_version
  s.dependency 'React/RCTText', react_native_version
  s.dependency 'React/RCTImage', react_native_version
  s.dependency 'React/RCTLinkingIOS', react_native_version
  s.dependency 'React/RCTSettings', react_native_version
  s.dependency 'React/RCTVibration', react_native_version
  s.dependency 'React/RCTGeolocation', react_native_version
  s.dependency 'React/RCTActionSheet', react_native_version
  s.dependency 'React/RCTAnimation', react_native_version
  s.dependency 'React/RCTNetwork', react_native_version
  s.dependency 'React/RCTWebSocket', react_native_version

End

And I'm unable to pass the linter checks when I run pod lib lint like this:

pod lib lint MyLibrary.podspec --sources=https://github.com/facebook/react-native.git,master

-> MyLibrary (0.1.0)
- WARN  | source: The version should be included in the Git tag.
- ERROR | [iOS] unknown: Encountered an unknown error (An 
 unexpected version directory `Base` was encountered for the 
 `/Users/administrator/.cocoapods/repos/facebook/React` Pod in the 
 `React` > repository.

I've read the documentation on https://guides.cocoapods.org and done lots of browsing but still not sure if this is the right podspec syntax to refer to a specific version of a repository, or if this is even supported or not?

(I'm using CocoaPods 1.3.1 XCode9 and Swift 4.)

kyuss
  • 143
  • 8

1 Answers1

2

The Podfile has the ability to override where to find a dependency. E.g. the git repo/tag. E.g. pod 'React', :git => 'https://github.com/artsy/React.git', :tag => '0.7.0'

The Podspec dicatates what the dependency is. e.g. s.dependency 'React'

orta
  • 4,225
  • 1
  • 26
  • 34
  • Thank you, just as I suspected, what I'm trying to do here is not even supported. But really curious, how does one overcome the problems incurred by the dictated dependency in a Podspec ? And what's the reason behind this different levels of flexibility of declaring dependencies between Podfile and Podspec? – kyuss Nov 08 '17 at 19:15
  • That makes sense. So far this is the only way for make React as a dependency of your own pod work. However, the `React` pod is deprecated, does that mean it might be removed from the registry at some point? And does this still work at that point? – Tieme Jul 19 '18 at 16:17