Search code examples
ioscocoapodstwilio

How to specify specific source for a certain pod?


Although I believe this is harmless, warnings quite irk me. So I'm using a very specific version of TwilioChatClient together with TwilioClient. These two specific versions are what Twilio have been using in their sample projects.

Anyways, the warning when installing / updating pods:

[!] Found multiple specifications for TwilioChatClient (1.0.9): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.9/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.9/TwilioChatClient.podspec

[!] Found multiple specifications for TwilioChatClient (1.0.8): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.8/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.8/TwilioChatClient.podspec

[!] Found multiple specifications for TwilioChatClient (1.0.7): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.7/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.7/TwilioChatClient.podspec

[!] Found multiple specifications for TwilioChatClient (1.0.6): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.6/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.6/TwilioChatClient.podspec

[!] Found multiple specifications for TwilioChatClient (1.0.5): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.5/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.5/TwilioChatClient.podspec

[!] Found multiple specifications for TwilioChatClient (1.0.4): - /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.4/TwilioChatClient.podspec.json - /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.4/TwilioChatClient.podspec

My podfile:

project 'Proj/Proj.xcodeproj'

source 'https://github.com/CocoaPods/Specs'
source 'https://github.com/twilio/cocoapod-specs'

platform :ios, '10.0'
use_frameworks!

  target 'Proj' do

    pod 'TwilioClient', '~>1.2'     # Twilio Call Framework
    pod 'TwilioChatClient', '1.0.4' # Twilio Chat Framework


    target 'MobileMedTests' do
        inherit! :search_paths
    end

    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.0'
            end
        end
    end

  end

  target 'ProjUITests' do

  end

I think specifying two kinds of sources (which are both necessary) causes these warnings. Is there a way to put the specific source right beside the pod?


Solution

  • In fact, your problem comes from the fact that you have added the twilio repo to your pod source with this line :

    source 'https://github.com/twilio/cocoapod-specs'
    

    So when you type pod repo, you obtain something like :

    master
    - Type: git (master)
    - URL:  https://github.com/CocoaPods/Specs.git
    - Path: /Users/cyrille/.cocoapods/repos/master
    
    twilio
    - Type: git (master)
    - URL:  https://github.com/twilio/cocoapod-specs
    - Path: /Users/cyrille/.cocoapods/repos/twilio
    

    And when you execute pod install, cocoa pods can find a version of this lib both in master's cocoapods repo and in twilio's one... which make the warning.

    To remove this warning, remove this line from your Podfile :

    source 'https://github.com/twilio/cocoapod-specs'
    

    In a terminal execute the following commands :

    pod repo remove twilio
    

    and then :

    pod update
    

    You should get the following with no more warnings :

    Analyzing dependencies
    Removing TwilioClient
    Downloading dependencies
    Installing TwilioChatClient 2.2.0 (was 1.0.4)
    Installing TwilioSDK (1.2.9)
    Generating Pods project
    Integrating client project
    Sending stats
    Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.