加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – 继承什么! :search_paths呢?

发布时间:2020-12-15 01:52:02 所属栏目:百科 来源:网络整理
导读:看了CocoaPods自己的例子(从 https://guides.cocoapods.org/syntax/podfile.html#abstract_target开始) # Note: There are no targets called "Shows" in any of this workspace's Xcode projectsabstract_target 'Shows' do pod 'ShowsKit' # The target Sh
看了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

我不明白为什么要继承! :search_paths是必要的吗?所有3个目标,ShowsiOS,ShowsTV和ShowsTests都可以从其父目标访问ShowsKit.

继承的具体例子! (从https://guides.cocoapods.org/syntax/podfile.html#inherit_bang开始)没有增加任何清晰度

target 'App' do
  target 'AppTests' do
    inherit! :search_paths
  end
end

你能帮我理解继承的东西吗? :search_paths是为了?

解决方法

根据 https://guides.cocoapods.org/syntax/podfile.html#inherit_bang,继承背后的目的!
?(我同意不是很清楚),是提供3之一:

Available Modes: + :complete The target inherits all behaviour from the parent. + :none The target inherits none of the behaviour from the parent. + :search_paths The target inherits the search paths of the parent only.

在这个问题的例子中,它是:正在表达的search_paths模式.测试Pod项目时,三种不同的模式可以起到不同的作用.

这是一个额外的链接https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html与Xcode中的框架搜索路径有关,这有助于为我清除一些混乱.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读