Cocoapod 规范:无法找到“Contents.json”的其他源参考

久美子*_*久美子 2 ios cocoapods swift

我想将 Assets.xcassets 添加到我的 pod 中,因此我已将以下内容添加到我的 podspec 中

      s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard}']
      s.resource_bundles = {'mysystem' => 'Classes/Resources/Assets.xcassets'}
Run Code Online (Sandbox Code Playgroud)

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

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

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

在此输入图像描述

我尝试了很多不同的其他方法,但没有一个有效:

  1. 我将 resources_bundles 替换为
      s.resources = ['Classes/Resources/Assets.xcassets']
Run Code Online (Sandbox Code Playgroud)
  1. 我还将 xcassets 添加到我的源文件中
     s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard, xcassets}']
Run Code Online (Sandbox Code Playgroud)

小智 5

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

将资源从源移动到其父文件夹。

项目结构

在此输入图像描述

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/**']
  }
Run Code Online (Sandbox Code Playgroud)