如何将现有podfile设置为与CocoaPods版本0.39.x和1.0.0兼容?

时间:2016-01-22 03:41:31

标签: ios cocoapods

我有以下podfile与0.39.x兼容。我想让它兼容cocoapods 1.0.0.beta.2?我的Podfile如下:

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

2 个答案:

答案 0 :(得分:2)

As answered here,Cocoapods 1.0.0兼容性的多种可能语法。

您可以定义公共pod(兼容0.39.0和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

或者定义一个抽象目标(仅兼容1.0.0):

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

答案 1 :(得分:1)

您应该发布您所面临的问题,但不会对您面临的问题提供帮助。

如果您意外更新到Cocoapods测试版并希望降级,则可以使用以下命令:

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 0.39.x