在同一项目中使用私有pod和公共pod

时间:2017-07-24 17:57:33

标签: ios git dependencies cocoapods cocoapods-1.2

我刚把私人吊舱推到了my.domain.com:apps/MyPrivatePod.git。我想在我的项目中使用这个私有pod和其他公共pod

platform :ios, '8.0'

target 'Testing' do
  pod 'AFNetworking', '2.6.0 ' // This is supposed to be a public Pod
  pod 'MyPrivatePod', '~> 1.1' // This is the private pod I talked about
end

我怎样才能做到这一点?

4 个答案:

答案 0 :(得分:4)

发布Cocoapods 1.7.2+之后,在Podfile中正确回答

source '<PRIVATE_POD_SPEC_URL>'
source 'https://cdn.cocoapods.org/'

答案 1 :(得分:0)

使用此选项并更改专用pod路径的路径

platform :ios, '8.0'

target 'Testing' do
  pod 'AFNetworking', '2.6.0 ' // This is supposed to be a public Pod
  pod 'MyPrivatePod', '~> 1.1' , :path => 'libraries/MyPrivatePod/'
end

希望这有助于你

答案 2 :(得分:0)

假设您构建了私有广告连播,请参阅the official docs并将其推送到您的私有规范索引报表,例如https://bitbucket.org/<your-name>/specs.git

之后,将规范索引repo url添加到Podfile

source 'https://github.com/CocoaPods/Specs.git'   # the official index spec
source 'https://bitbucket.org/<your-name>/specs.git'  # your private index spec

现在像往常一样使用它们。

target 'foo-target' do
    pod 'CocoaLumberjack', '~> 3.2'    # public pod, cloned from cocoapods/specs.git
    pod 'MyPrivatePod', '~> 1.1'       # private pod, cloned from your private specs.git
end
祝你好运!

答案 3 :(得分:0)

如果您有私人要求,则使用源网址,例如“ https://cdn.cocoapods.org/”而不是“ https://github.com/CocoaPods/Specs.git

CocoaPods-1.7.2