1

I have got the following podfile which is compatible with 0.39.x. I would like to make it compatible to cocoapods 1.0.0.beta.2? My Podfile is as follow:

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

platform :ios, '7.0'

# ignore all warnings from all pods
inhibit_all_warnings!

target 'ATests', :exclusive => true do
    pod 'AFNetworking', '~> 2.5.4'
end

link_with 'A', 'B', 'C', 'D'

pod 'WebViewJavascriptBridge', '4.1.0'
pod 'OBShapedButton', '1.0.2'
pod 'ReactiveCocoa', '2.2.4'
pod 'CocoaLumberjack', '2.0.0-beta4'
pod 'IBCustomFonts', '0.0.1'
pod 'CHDataStructures', '0.0.1'
pod 'Smooth-Line-View', :git => 'git://github.com/kccheung/Smooth-Line-View', :commit => 'c12b870f2cca75c752e0fb47d2f4d1c09ea02c94'
pod 'UIMenuItem+CXAImageSupport', :git => 'git://github.com/cxa/UIMenuItem-CXAImageSupport', :commit => 'd11a08af89b0e07ae2c1720e9c16b746dc47037d'
pod 'CrittercismSDK'
pod 'SSZipArchive'
pod 'AFDownloadRequestOperation', '2.0.1'
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod 'RNCryptor', '~> 2.2'
pod 'AFNetworking', '~> 2.5.4'
pod 'AFNetworkActivityLogger'
pod 'nv-ios-http-status'
pod 'FLEX', '~> 2.0'

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO"
        end
    end
end
Cœur
  • 37,241
  • 25
  • 195
  • 267
chubao
  • 5,871
  • 6
  • 39
  • 64

2 Answers2

2

As answered here, multiple possible syntaxes for Cocoapods 1.0.0 compatibility.

You can either define common pods (compatible 0.39.0 and 1.0.0):

platform :ios, '7.0'

inhibit_all_warnings!

def default_pods
    pod 'WebViewJavascriptBridge', '4.1.0'
    pod 'OBShapedButton', '1.0.2'
    pod 'ReactiveCocoa', '2.2.4'
    pod 'CocoaLumberjack', '2.0.0-beta4'
    pod 'IBCustomFonts', '0.0.1'
    ...
end

target 'A' do
    default_pods
end
target 'B' do
    default_pods
end
target 'C' do
    default_pods
end
target 'D' do
    default_pods
end
target 'ATests' do
    default_pods
    pod 'AFNetworking', '~> 2.5.4'
end

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

Or define an abstract target (compatible 1.0.0 only):

platform :ios, '7.0'

inhibit_all_warnings!

abstract_target 'default_pods' do
    pod 'WebViewJavascriptBridge', '4.1.0'
    pod 'OBShapedButton', '1.0.2'
    pod 'ReactiveCocoa', '2.2.4'
    pod 'CocoaLumberjack', '2.0.0-beta4'
    pod 'IBCustomFonts', '0.0.1'
    ...

    target 'A'
    target 'B'
    target 'C'
    target 'D'
    target 'ATests' do
        inherit! :search_paths
        pod 'AFNetworking', '~> 2.5.4'
    end
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO"
        end
    end
end
Community
  • 1
  • 1
Cœur
  • 37,241
  • 25
  • 195
  • 267
1

You should post the issues that you are facing, without that it's hard to help on issues you are facing.

If you have accidently updated to Cocoapods beta and want to downgrade you can use the following commands:

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 0.39.x
gagarwal
  • 4,224
  • 2
  • 20
  • 27
  • I have done this. But I just wonder if I could set the Podfile such that it is compatible to both cocoapods 0.39.x and 1.0.0.beta.2? – chubao Jan 22 '16 at 03:53
  • @DavidCheung, in most cases, yes. But not if you were using `:head` for example. – Cœur Jan 28 '16 at 06:16
  • 1
    @gagarwal, it might be better to keep both versions installed, and when you want to use the old one, you call `pod _0.39.0_ update` for example. – Cœur Jan 28 '16 at 06:24