Vigneshkumar G
Vigneshkumar G

Reputation: 348

Cocoapods - Found multiple specifications warning

On pod install, I am getting warning like Found multiple specifications for "<Pod Name>"

It means that I have multiple Podspecs in this directory ~/cocoapods/repo

Example Podfile:

source '<Private Podspec>'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'SDKDemo' do
  use_frameworks!    
  pod '<Pod Name>'
end 

My question is that

  1. which Podspec will be used when installing pod.
  2. If Podspec is taken from <Private Podspec>, How it will work in this case
source 'https://github.com/CocoaPods/Specs.git'
source '<Private Podspec>'

I came to conclusion like order of source will affect deciding the Podspec. But I want to clarify this.

Upvotes: 11

Views: 22666

Answers (4)

ViktoR
ViktoR

Reputation: 761

I had both source 'https://cdn.cocoapods.org/' and source 'https://github.com/CocoaPods/Specs.git' included in Podfile

source 'https://cdn.cocoapods.org/'
source 'https://github.com/CocoaPods/Specs.git'

After removing source 'https://github.com/CocoaPods/Specs.git' the warnings gone.

Upvotes: 12

trqhien
trqhien

Reputation: 792

In Cocoapods version 1.8.x, I fixed this issue by changing the source from source 'https://github.com/CocoaPods/Specs.git' to source 'https://cdn.cocoapods.org/' in Podfile

It also depends on the errors that you receive. It is always useful to check in ~/.cocoapods/repos folder to see what repos are causing the warnings. It could be that you have two instances of your private podspec in ~/.cocoapods/repos. In my case I had this

[!] Found multiple specifications for `GoogleUtilities (6.2.4)`:
- /Users/hientran/.cocoapods/repos/master/Specs/0/8/4/GoogleUtilities/6.2.4/GoogleUtilities.podspec.json
- /Users/hientran/.cocoapods/repos/trunk/Specs/0/8/4/GoogleUtilities/6.2.4/GoogleUtilities.podspec.json

Simply remove master repo and I've never seen that warning since then

pod repo remove master

Upvotes: 3

Mark P
Mark P

Reputation: 21

The CocoaPods Guides have the answer:

The order of the sources is relevant. CocoaPods will use the highest version of a Pod of the first source which includes the Pod (regardless whether other sources have a higher version).

Whichever source you enter first will be the first source CocoaPods will look for the pod.

For Question #1: Since you have source '<Private Podspec>' first, that's what it will use.

For Question#2: Since you have source 'https://github.com/CocoaPods/Specs.git' first, that's what it will use.

https://guides.cocoapods.org/syntax/podfile.html#tab_source

Upvotes: 1

eMdOS
eMdOS

Reputation: 1713

On my side, that approach (changing the order of the sources) never worked.

I needed to specify the source for my private pod in order to make it work. The reason is that my private pod registered in my private specs repo has the same name than another one registered in the public cocoapods specs repo.

i.e.:

source 'https://github.com/CocoaPods/Specs.git' # public cocoapods specs repo
source 'https://github.com/{:user}/specs.git' # my private specs repo

platform :ios, '11.0'

target 'MyAppTarget' do
  use_frameworks!
  # any other public pod ...
  pod 'PrivatePod', :source => 'https://github.com/{:user}/specs.git'
end

This is what solved my issue.

Upvotes: 7

Related Questions