【问题标题】:Cocoapod spec: Unable to find other source ref for `Contents.json`Cocoapod 规范:无法找到“Contents.json”的其他源引用
【发布时间】:2020-07-27 17:12:36
【问题描述】:

我想将我的 Assets.xcassets 添加到我的 pod 中,所以我在我的 podspec 中添加了以下内容

      s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard}']
      s.resource_bundles = {'mysystem' => 'Classes/Resources/Assets.xcassets'}

执行 pod lib lint 后,我​​不断收到此错误

    - ERROR | [iOS] unknown: Encountered an unknown error (Unable to find other source ref for `Contents.json` for target `mysystem`.) during validation.

这是我的资源文件夹中的样子

我已经尝试了很多不同的其他方法,但都没有奏效:

  1. 我将 resources_bundles 替换为
      s.resources = ['Classes/Resources/Assets.xcassets']
  1. 我还在我的源文件中添加了 xcassets
     s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard, xcassets}']

【问题讨论】:

    标签: ios swift cocoapods


    【解决方案1】:

    我得到了完全相同的错误。解决办法是,

    将资源从 Source 移至其父文件夹。

    项目结构

    podspec 看起来像这样

    s.ios.deployment_target = '13.0'
    
      s.source_files = 'Source/**/**'
      s.swift_version = '5.0'
      s.platforms = {
        "ios": "13.0"
      }
      
      s.resource_bundles = {
        'MotionToastView' => ['MotionToastView/**']
      }
    

    【讨论】:

      【解决方案2】:

      会发生此错误的原因是 Contents.json 位于源文件夹中的某个位置(我们在 .podspec 文件中指定)。

      您应该仔细检查您的源文件夹是否只包含代码而不包含其他任何内容。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-11-12
        • 2020-07-05
        • 2019-04-11
        • 1970-01-01
        • 2016-01-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多