看完CocoaPods的示例之后(来自https://guides.cocoapods.org/syntax/podfile.html#abstract_target)
# Note: There are no targets called "Shows" in any of this workspace's Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
# The target ShowsiOS has its own copy of ShowsKit (inherited) + ShowWebAuth (added here)
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# The target ShowsTV has its own copy of ShowsKit (inherited) + ShowTVAuth (added here)
target 'ShowsTV' do
pod 'ShowTVAuth'
end
# Our tests target has its own copy of
# our testing frameworks, and has access
# to ShowsKit as well because it is
# a child of the abstract target 'Shows'
target 'ShowsTests' do
inherit! :search_paths
pod 'Specta'
pod 'Expecta'
end
end
我看不出为什么需要
inherit! :search_paths
? ShowsiOS
,ShowsTV
和ShowsTests
这3个目标都可以从其父目标访问ShowsKit
。inherit!
的特定示例(来自https://guides.cocoapods.org/syntax/podfile.html#inherit_bang)没有增加任何清晰度target 'App' do
target 'AppTests' do
inherit! :search_paths
end
end
您能帮我了解
inherit! :search_paths
是什么意思吗? 最佳答案
根据https://guides.cocoapods.org/syntax/podfile.html#inherit_bang,inherit!
背后的目的
(我同意不是很清楚)是提供3种可用模式之一:
:complete
目标从父级继承所有行为。 :none
目标不会从父级继承任何行为。 :search_paths
目标仅继承父级的搜索路径。 在此问题的示例中,正在表达的是
:search_paths
模式。测试Pod项目时,三种不同的模式扮演不同的角色。与Xcode中的框架搜索路径有关的Here is an additional link帮助我消除了一些困惑。