Que*_*tin 39 xcode ios cocoapods
看了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
Run Code Online (Sandbox Code Playgroud)
我不明白为什么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
Run Code Online (Sandbox Code Playgroud)
你能帮我理解一下inherit! :search_paths吗?
Chr*_*yes 17
后面的目的inherit!,根据https://guides.cocoapods.org/syntax/podfile.html#inherit_bang
(我同意不太清楚),是提供3种可用模式之一:
:complete 目标继承父项的所有行为. :none 目标不会从父级继承任何行为.:search_paths 目标仅继承父项的搜索路径.在这个问题的例子中,它:search_paths是正在表达的模式.测试Pod项目时,这三种不同的模式可以起到不同的作用.
这是一个关于Xcode中的框架搜索路径的附加链接,这有助于我清除一些混乱.
CocaPods 和继承!
具有依赖性的内部目标可以使用此功能。最好的例子是Test target使用app target. 在这种情况下,您可以在[About] 中创建层次结构Podfile
target 'App' do
target 'Tests' do
# inherit! :none # empty
# inherit! :complete # by default if you do not specify any inherit!
# inherit! :search_paths # uses only `search` paths
end
end
Run Code Online (Sandbox Code Playgroud)
查看生成的Pods/Targets Support Files/目录并进行比较
Pods-<App_target_name>/Pods-<App_target_name>.<debug/release>.xcconfig
Pods-<Test_target_name>/Pods-<Test_target_name>.<debug/release>.xcconfig
Run Code Online (Sandbox Code Playgroud)
您会发现传递给项目目标[About]的inherit!设置对于不同的设置是不同的。
如果inherit! :search_paths- FRAMEWORK_SEARCH_PATHS, HEADER_SEARCH_PATHS... 的内部目标是从外部目标继承的,并被传递到相应的字段中Build Settings
的用例inherit! :complete。当您开发一个具有第三方动态框架的框架并且您有一个测试目标时。如果您不这样做并运行测试,您将获得dyld: Library not loaded[关于]
| 归档时间: |
|
| 查看次数: |
11190 次 |
| 最近记录: |