2

I've just pushed a private pod to my.domain.com:apps/MyPrivatePod.git. I'd like to use both this private pod and other public pods in my project

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

How can I achieve this?

7ball
  • 2,183
  • 4
  • 26
  • 61

4 Answers4

5

After Cocoapods 1.7.2+ release, right answer in Podfile

source '<PRIVATE_POD_SPEC_URL>'
source 'https://cdn.cocoapods.org/'
muhasturk
  • 2,534
  • 20
  • 16
  • This is the way! I have tried to use `source 'https://github.com/CocoaPods/Specs.git'`, it clones and process for way too long time. By using `source 'https://cdn.cocoapods.org/'` it works smoothly! – BananZ May 13 '20 at 03:03
  • I was struggling since 2 days. This worked like a charm. – abhi Sep 10 '20 at 14:16
2

Assume you have built the private pod refer to the official docs and push it to your private spec index repo, for example, https://bitbucket.org/<your-name>/specs.git.

After that, add the spec index repo url into your Podfile.

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

Now use them as usual.

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

Good luck!

Itachi
  • 5,777
  • 2
  • 37
  • 69
  • This is the only solution that works for adding private and public repo together in one pod file. as well as if you have private pod where you want to use another private pod as a dependency then also this solution works. Thanks Itachi – Mridul Gupta Jun 25 '19 at 16:22
  • THX! best anz. using the pod repo add method is really a pain in the xxx for me – zuyao88 Aug 23 '19 at 04:16
0

Use this and change the path for your private pod path

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

Hope this helps you

Reinier Melian
  • 20,519
  • 3
  • 38
  • 55
0

If you have private specs, then source url like this 'https://cdn.cocoapods.org/' instead of 'https://github.com/CocoaPods/Specs.git'

CocoaPods-1.7.2

Yuşa
  • 1