在看了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是必要的?所有3个目标ShowsiOS、ShowsTV和ShowsTests都可以从其父目标访问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是用来做什么的吗?
发布于 2017-02-04 11:34:14
根据https://guides.cocoapods.org/syntax/podfile.html#inherit_bang的说法(我同意这一点并不是很清楚),inherit!背后的目的是提供三种可用的模式之一:
:complete目标继承父级的所有行为。:none目标不继承parent.:search_paths的任何行为,目标仅继承父级的搜索路径。在这个问题的例子中,表达的是:search_paths模式。这三种不同的模式在测试Pod项目时会起到不同的作用。
与Xcode中的框架搜索路径相关的Here is an additional link帮助我理清了一些疑惑。
https://stackoverflow.com/questions/37060065
复制相似问题