我正在尝试使用安装后挂钩将$(PLATFORM_DIR)/Developer/Library/Frameworks路径添加到Specta目标标头搜索路径。这显然并不重要,但每次我做"pod更新“时手动添加这个路径真的让我很恼火。
我看了下面的脚本:
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Specta'
target.build_configurations.each do |config|
headers = config.build_settings['HEADER_SEARCH_PATHS']
if headers
config.build_settings['HEADER_SEARCH_PATHS'] += ' $(PLATFORM_DIR)/Developer/Library/Frameworks'
end
end
end
end
end如果有人能给我指明正确的方向,我会很高兴的,因为我真的被困住了。
附注:我已经注意到CocoaPods已经添加了这条路径,但我仍然对如何做到这一点非常感兴趣,因为这些知识以后可能会有用。谢谢!
发布于 2018-07-23 16:06:49
在Podfile中定义方法:
def append_header_search_path(target, path)
target.build_configurations.each do |config|
# Note that there's a space character after `$(inherited)`.
config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
config.build_settings["HEADER_SEARCH_PATHS"] << path
end
end然后在post_install中调用该方法
installer.pods_project.targets.each do |target|
if target.name == "Specta"
append_header_search_path(target, "$(PLATFORM_DIR)/Developer/Library/Frameworks")
end
endhttps://stackoverflow.com/questions/26260975
复制相似问题