Cocoapods "pod update" installs old pods

youritrg picture youritrg · Dec 29, 2015 · Viewed 19.4k times · Source

I am trying to set up CI on Xcode Server by creating a bot for an iOS app. I use CocoaPods so I'm using the script below to install the pods:

export LANG=en_US.UTF-8
#!/bin/bash
cd "$XCS_SOURCE_DIR/{PROJECTNAME}"
if [ -e "Pods" ]
then
/usr/local/bin/pod update
else
/usr/local/bin/pod install
fi

The current version of CocoaPods 0.39.0 is installed on the server. When I run "pod update" on the server everything is alright and the newest pods are installed.

Using FBAudienceNetwork (4.7.0)
Using FBSDKCoreKit (4.8.0)
Using Fabric (1.6.1)
Using FyberSDK (8.1.2)
Using Google-Mobile-Ads-SDK (7.6.0)
Using GoogleAnalytics (3.14.0)

When I use the script above however something strange happens.

Installing FBAudienceNetwork (4.1.0)
Installing FBSDKCoreKit (4.4.0)
Installing Fabric (1.2.8)
Installing FyberSDK (7.2.4)
Installing Google-Mobile-Ads-SDK (7.3.1)
Installing GoogleAnalytics (3.13.0)

Anyone has any idea why old versions are installed with the script? I use OS X Server 5.0.15 and Xcode 7.2.

The podfile:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, "8.0"
use_frameworks!

target "{PROJECTNAME}" do
    inhibit_all_warnings!

    pod 'AFNetworking'
    pod 'Branch'
    pod 'SwrveSDK'
    pod 'RealmSwift'
    pod 'MZTimerLabel'
    pod 'pop' 
    pod 'Adjust'
    pod 'JSQMessagesViewController'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'GoogleAnalytics'
    pod 'FBSDKCoreKit'
    pod 'FyberSDK'
    pod 'AdColony'
    pod 'Google-Mobile-Ads-SDK'
    pod 'ChartboostSDK'
    pod 'FBAudienceNetwork'
    pod 'VungleSDK-iOS'
end

target "{PROJECTNAME}Tests" do
    inhibit_all_warnings!

    pod 'AFNetworking'
    pod 'Branch'
    pod 'SwrveSDK'
    pod 'RealmSwift'
    pod 'MZTimerLabel'
    pod 'pop'
    pod 'Adjust'
    pod 'JSQMessagesViewController'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'GoogleAnalytics'
    pod 'FBSDKCoreKit'
    pod 'FyberSDK'
    pod 'AdColony'
    pod 'Google-Mobile-Ads-SDK'
    pod 'ChartboostSDK'
    pod 'FBAudienceNetwork'
end

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

Answer

youritrg picture youritrg · Dec 30, 2015

I've got it working now! I didn't know about the _xcsbuildd user which does the builds. I found more about this here: https://honzadvorsky.com/articles/2015-08-17-17-30-xcode_server_tutorials_3_prebuild__postbuild_scripts/

So after logging in as this user I saw the same problem in the terminal on the server. Old versions of the pods were downloaded. The master repository of CocoaPods has some error, so I did

rm -rf ~/.cocoapods/repos/master

Then I ran

pod setup --verbose

And the master repository with the Cocoapods specs was installed again. Now it works!