7
나는 왜 내 post_install 후크가 내가 기대하는 출력을 내고 있지 않는지 알아 내려고 며칠 동안 돌았 다. 여기 내 Podfile입니다 :cocoapods post_install이 전 처리기 매크로를 업데이트하지 못하는 이유는 무엇입니까?
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
내가 가진 질문은 : 새로운 매크로 정의와 디버그 구성 업데이트가 아닌 이유 ? 출력에서 릴리스 구성이 올바르게 설정되었지만 디버그가 설정되지 않았 음을 볼 수 있습니다.
아이디어가 있으십니까?
두 번째 줄은 필요 없습니다. config.build_settings [ 'GCC_PREPROCESSOR_DEFINITIONS'] << 'SC_DEBUG_SCCOMMON'이것은 값없이 텍스트를 추가하기 만하면됩니다. 적어도 이것을 테스트하는 동안 얻은 것입니다. 이 같은 문제가있는 사람들은 대상 이름이 올바른지 먼저 확인하십시오. – David