Using private pod and public pod in the same project

2.2k Views Asked by At

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?

4

There are 4 best solutions below

0
Reinier Melian On

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

2
Itachi On

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!

2
muhasturk On

After Cocoapods 1.7.2+ release, right answer in Podfile

source '<PRIVATE_POD_SPEC_URL>'
source 'https://cdn.cocoapods.org/'
0
Yuşa On

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