几天来,我一直在转来转去,试图弄清楚为什么我的 post_install 钩子没有产生我期望的输出。这是我的 Podfile:
source 'https://github.com/CocoaPods/Specs.git'
target "SCCommon" do
platform :ios, "6.0"
pod 'AFNetworking', '~> 1.2.1'
pod 'Mantle', '~> 1.3'
pod 'PubNub', '3.5.5'
end
target "SCCommon-TestHarness" do
platform :ios, "6.0"
# inhibit_all_warnings!
pod 'SCCommon', :path => '../SCCommon.podspec'
end
target "SCCommon-UnitTests" do
platform :ios, "6.0"
# inhibit_all_warnings!
pod 'OCMock', '2.2.3'
pod 'SCCommon', :path => '../SCCommon.podspec'
end
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Pods-SCCommon-UnitTests'
puts "Setting preprocessor macro for #{target.name}..."
target.build_configurations.each do |config|
puts "#{config} configuration..."
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)','SC_DEBUG_SCCOMMON=1','FOOBAR']
puts config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
puts '---'
end
end
end
end
在上面运行后pod update
,我得到以下输出:
Update all pods
Analyzing dependencies
CocoaPods 0.35.0 is available.
To update use: `sudo gem install cocoapods`
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Fetching podspec for `SCCommon` from `../SCCommon.podspec`
Downloading dependencies
Using AFNetworking (1.2.1)
Using Mantle (1.5.1)
Using OCMock (2.2.3)
Using PubNub (3.5.5)
Using SCCommon (0.3)
Generating Pods project
Setting preprocessor macro for Pods-SCCommon-UnitTests...
Release configuration...
$(inherited)
SC_DEBUG_SCCOMMON=1
FOOBAR
---
Debug configuration...
DEBUG=1
$(inherited)
---
Integrating client project
我的问题是:为什么调试配置没有用新的宏定义更新?您可以在输出中看到 Release 配置设置正确,但不是 Debug。
有任何想法吗?