【问题标题】:The `source_files` pattern did not match any file`source_files` 模式与任何文件都不匹配
【发布时间】:2019-12-12 10:45:57
【问题描述】:

在私有 pod 的情况下,指向源文件的正确方法是什么? 我想创建自己的 pod,但无法通过 source_files 正确提及来解决问题。

这是我现在的做法:

s.source_files = "PromocodeTest/**/*"

这是我尝试过的方法,但没有任何效果

s.source_files = "PromocodeTest/Source/*.swift"

s.source_files = "PromocodeTest.{h}"

这是我的项目的设置方式

每次我运行 pod spec lint 时都会出现上述错误:[iOS] 文件模式:source_files 模式与任何文件都不匹配。

帮我解决问题

【问题讨论】:

    标签: ios swift cocoapods


    【解决方案1】:

    当您创建自己的私有 POD(通过终端或 Finder 进行检查)时,通常会有这样的文件夹结构:

     - Example
     - README.md
     - PromocodeTest.podspec
     - LICENSE
     - PromocodeTest
       |- Classes
       |- Resources
     - _Pods.xcodeproj
    

    如您所见,应该有一个PromocodeTest 文件夹,其中正好包含两个子文件夹,即ClassesResources

    假设您的 .podspec 或在本例中的 PromocodeTest.podspec 看起来像:

    Pod::Spec.new do |s|
      s.name             = 'PromocodeTest'
      s.version          = '0.1.0'
      s.summary          = 'PromocodeTest summary description'
    
      s.homepage         = 'https://bitbucket.org/privaterepo/promocodetest'
      s.license          = { :type => 'MIT', :file => 'LICENSE' }
      s.author           = { 'PrivateAuthor' => 'private.author@company.com' }
      s.source           = { :git => 'git@bitbucket.org:privaterepo/promocodetest.git', :tag => s.version.to_s }
    
      s.ios.deployment_target = '10.0'
    
      s.source_files = 'PromocodeTest/Classes/**/*'
      s.resources = 'PromocodeTest/Resources/Assets/*.xcassets'
    
      s.ios.frameworks = 'UIKit'
    end
    

    PS:如果您无法正确设置它,请再次尝试从头开始创建一个 pod 项目并按照此 guide from CocoaPods using Pod Lib Create 尝试它应该会自动为您创建这些 Classes 和 Resources 文件夹并正确链接它们在你的 pod 项目的配置中(即.xcodeproj

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-01
      • 1970-01-01
      • 2017-02-08
      • 2021-05-22
      • 1970-01-01
      • 2020-12-26
      • 1970-01-01
      相关资源
      最近更新 更多