这个问题在这里已经有了答案:
Integrating pods with all targets
(4 个回答)
6年前关闭。
我有以下与 0.39.x 兼容的 podfile。我想让它与 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
最佳答案
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
关于ios - 如何将现有的 podfile 设置为兼容 CocoaPods 版本 0.39.x 和 1.0.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34938620/